今天在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)的更多相关文章

  1. 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 ...

  2. 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对象 ...

  3. **PHP错误Cannot use object of type stdClass as array in错误的

    错误:将PHP对象类型当做了PHP数组  解决方法:用对象操作符-> 今天在PHP输出一个二维数组的时候,出现了“Fatal error: Cannot use object of type s ...

  4. PHP“Cannot use object of type stdClass as array”

    php再调用json_decode从字符串对象生成json对象时,如果使用[]操作符取数据,会得到下面的错误 错误:Cannot use object of type stdClass as arra ...

  5. Fatal error: Cannot use object of type PHPExcel_RichText as array

    Fatal error: Cannot use object of type PHPExcel_RichText as array 上传导入Excel的时候会出现此问题,问题的原因是Excel表格中有 ...

  6. MyBatis Generator报错:Cannot instantiate object of type

    [ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate ( ...

  7. 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 ...

  8. Unable to cast object of type 'System.Int32' to type 'System.Array'.

    x 入职了新公司.最近比较忙...一看博客...更新频率明显少了...罪过罪过... 新公司用ASP.NET MVC 遇上一个错误: Unable to cast object of type 'Sy ...

  9. 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 ...

随机推荐

  1. 微软Power BI 每月功能更新系列——10月Power BI 新功能学习

    Power BI Desktop10月产品功能摘要 本月Power Plus Desktop的更新充满了整个产品的小型和大型改进.一个巨大的更新是Power BI服务支持我们的复合模型和聚合预览.这实 ...

  2. 【转载】 强化学习(四)用蒙特卡罗法(MC)求解

    原文地址: https://www.cnblogs.com/pinard/p/9492980.html ------------------------------------------------ ...

  3. Implementing a CNN for Text Classification in TensorFlow

    参考: 1.Understanding Convolutional Neural Networks for NLP 2.Implementing a CNN for Text Classificati ...

  4. Django自定义查询对象

    在Django中,objects对象类继承于models.Manager 1.声明 EntryManager 类,继承自 models.Manager 允许在 EntryManager中增加自定义函数 ...

  5. vs2015连接mysql进行数据库操作

    要求:电脑提前安装好vs,mysql. 1.在需要连接mysql的项目上右键选择“属性” -> “C/C++” -> “常规” ->选择“附加包含目录” 在弹出窗口中添加mysql的 ...

  6. SEO:关键词布局

  7. 多行文本用textarea而不是input type=textarea“”

    <textarea name="zhaiyao" id="" cols="35" rows="4">< ...

  8. Android系统备忘1

    Android的4种模式 模式 功能 ADB调试system 正常使用 开发者模式开启usb调试recovery 备份,恢复模式 卡刷模式 twrp下开启ADB Sideloadfastboot 线刷 ...

  9. 自定义ThreadPoolExecutor带Queue缓冲队列的线程池 + JMeter模拟并发下单请求

    .原文:https://blog.csdn.net/u011677147/article/details/80271174 拓展: https://github.com/jwpttcg66/GameT ...

  10. 找DEV,欢迎挑战高薪 --方向:互联网金融,地点广州

    http://kaolalicai.cn/#/join 企业文化 加入财略 = 进取!自由!快乐 Get things done,坚持,进取 学习型企业,员工培训,交互学习 人性化管理,气氛和谐,快乐 ...