数组中的stdClass Object如何访问
2024-09-10 00:18:26
使用print_r($data)输出结果为 Array
(
[0] => stdClass Object
(
[color_item_no] => 1
[color_name] => sdf
[size_item_no] => 1
[size] => S
[jar_no] => 45
[qty] => 45
[stand_wgt] =>
[qty_unit] => 1
) [1] => stdClass Object
(
[color_item_no] => 1
[color_name] => sdf
[size_item_no] => 2
[size] => M
[jar_no] => 45
[qty] => 45
[stand_wgt] =>
[qty_unit] => 1
)
)
这种情况下一般使用任何框架原本的输出方法可能都会出错,比如laravel框架中 echo $data[0]['qty'];会报stdClass Object这个问题,那么这个时候就$data[0]->qty就可以了。
最新文章
- 谈谈一些有趣的CSS题目(三)-- 层叠顺序与堆栈上下文知多少
- 从零开始学 Java - Spring 支持 CORS 请求踩的坑
- hdu 1097 A hard puzzle
- win平台检查内存泄露
- Oracle VM VirtualBox虚拟机安装系统
- Secant Method (Website)
- PHP对象类型在内存中的分配
- linux/unix运行级别
- 个人信用卡管理 - iOS UI原型
- Java学习笔记之接口和抽象类
- MySQL解决";is marked as crashed and should be repaired";故障
- redhat 6 红帽6 Linux 网络配置
- 鉴权完成后如何拿到SpringSocial的用户信息
- Rsync + Sersync 实现数据增量同步
- JS字符串常用方法总结
- [xdoj] 1310 DSKer的卡牌游戏
- SQL Server 数值四舍五入,小数点后保留2位
- spring cloud 知识点
- JSON数据生成树——(四)
- FocusBI: SSIS体系结构(原创)
热门文章
- C++ map的方法
- docker的安装教程
- Python爬虫实例(四)网站模拟登陆
- :after和:before 伪类
- RoR- Database setup&; SQLite ... Migrations
- python类型错误:'NoneType' object is not subscriptable
- 15.IEnumerable和IEnumerator
- Java作业(一)
- linux 下tftpf搭建
- Go 初体验 - 死锁的几种情况