[乐意黎原创]php 抛Fatal error: Cannot use object of type stdClass as array in XXX的解决方法


php 使用 var_dump( $curDayItemsJson["comm_msg_info"]);


抛Fatal error:  Cannot use object of type stdClass as array in 错误,如图: 


items: 10

<b>Fatal error</b>:  Cannot use object of type stdClass as array in <b>E:\PHPCMS\Cms\www.aerchi.com\weixin\weixin-search.php</b> on line <b>490</b>

[乐意黎原创]php 抛Fatal error: Cannot use object of type stdClass as array in XXX的解决方法_第1张图片


其实,数组中是返回的是一个对象,不能直接用[]来显示,正确的输出方法是: $curDayItemsJson->comm_msg_info

终于成功解决,标记一下。

乐意黎原创
本文地址:   http://blog.csdn.net/aerchi/article/details/51272067


你可能感兴趣的:([乐意黎原创]php 抛Fatal error: Cannot use object of type stdClass as array in XXX的解决方法)