iwebshop (: Cannot use object of type stdClass as array in)
今天在PHP输出一个二维数组的时候,出现了“Fatal error: Cannot use object of type stdClass as array in……”。
这个二维数组是这样的:
Array (
[] => stdClass Object (
[id] =>
[title] => 首页招聘
[size] => *
[pic] => ./upload/.jpg
[state] => )
[] => stdClass Object (
[id] =>
[title] => 首页领队
[size] => *
[pic] => ./upload/.jpg
[state] => )
)
输出开始写的方法是:$pic[0][title]
结果就出现上面的错误。
其实,数组中是返回的是一个对象,不能直接用[]来显示,正确的输出方法是:$pic[0]->title
这里就是记录一下。
iwebshop (: Cannot use object of type stdClass as array in)的更多相关文章
- PHP“Cannot use object of type stdClass as array” (php在调用json_decode从字符串对象生成json对象时的报错)
php再调用json_decode从字符串对象生成json对象时,如果使用[]操作符取数据,会得到下面的错误 错误:Cannot use object of type stdClass as arra ...
- PHP json_decode object时报错Cannot use object of type stdClass as array
PHP json_decode object时报错Cannot use object of type stdClass as array php再调用json_decode从字符串对象生成json对象 ...
- **PHP错误Cannot use object of type stdClass as array in错误的
错误:将PHP对象类型当做了PHP数组 解决方法:用对象操作符-> 今天在PHP输出一个二维数组的时候,出现了“Fatal error: Cannot use object of type s ...
- PHP“Cannot use object of type stdClass as array”
php再调用json_decode从字符串对象生成json对象时,如果使用[]操作符取数据,会得到下面的错误 错误:Cannot use object of type stdClass as arra ...
- Fatal error: Cannot use object of type PHPExcel_RichText as array
Fatal error: Cannot use object of type PHPExcel_RichText as array 上传导入Excel的时候会出现此问题,问题的原因是Excel表格中有 ...
- MyBatis Generator报错:Cannot instantiate object of type
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate ( ...
- spring boot 之 错误:SpelEvaluationException: EL1008E: Property or field 'timestamp' cannot be found on object of type 'java.util.HashMap'
这个错误我也见过很多次了,今天终于理解了其出现的原因. 错误是这样的: 2017-11-23 18:05:39.504 ERROR 4092 --- [nio-8080-exec-3] o.a.c.c ...
- Unable to cast object of type 'System.Int32' to type 'System.Array'.
x 入职了新公司.最近比较忙...一看博客...更新频率明显少了...罪过罪过... 新公司用ASP.NET MVC 遇上一个错误: Unable to cast object of type 'Sy ...
- celery 4.1下报kombu.exceptions.EncodeError: Object of type 'bytes' is not JSON serializable 处理方式
#python代码如下 from celery import Celeryimport subprocess app = Celery('tasks', broker='redis://localho ...
随机推荐
- tomcat自动缓存的几种解决方式
第一种方法:打开一个项目,这里我打开的Mail项目,然后点击Myeclipse菜单栏中的project-选择clean: 选择要clean的项目,确定即可不用进入tomcat服务器直接清理缓存. 上面 ...
- MSDN Windows各版本哈希值
Windows 7 Enterprise (x64) - DVD (English)文件名 en_windows_7_enterprise_x64_dvd_x15-70749.isoSHA1: A89 ...
- i.MX6 u-boot 怎么确定板级头文件
/********************************************************************** * i.MX6 u-boot 怎么确定板级头文件 * 说 ...
- 【leetcode】66-PlusOne
problem Plus One code class Solution { public: vector<int> plusOne(vector<int>& digi ...
- [LeetCode&Python] Problem 860. Convert BST to Greater Tree
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original B ...
- HDU5658:CA Loves Palindromic (回文树,求区间本质不同的回文串数)
CA loves strings, especially loves the palindrome strings. One day he gets a string, he wants to kno ...
- 洛谷 P4779 :【模板】单源最短路径(标准版)(Dijkstra+堆优化+链式前向星)
题目背景 2018 年 7 月 19 日,某位同学在 NOI Day 1 T1 归程 一题里非常熟练地使用了一个广为人知的算法求最短路. 然后呢? 100→60: Ag→Cu: 最终,他因此没能与理想 ...
- Python--函数对象@命名空间与作用域@包函数@装饰器@迭代器@内置函数
一.函数对象 函数(Function)作为程序语言中不可或缺的一部分,但函数作为第一类对象(First-Class Object)却是 Python 函数的一大特性. 那到底什么是第一类对象(Firs ...
- [原]android 链接错误
由于没有使用NDK的makefile, 而是把NDK的toolchain集成到现有的build system, 所以出现了诡异的错误: unsupported dynamic reloc R_ARM_ ...
- openresty redis all in one docker demo
一个简单的docker demo 集成openresty+ redis,可以实现基于redis的动态修改反向代理的处理 环境准备 docker-compose 文件 version: " ...