PHP「Cannot use object of type stdClass as array」

php調用json_decode從字符串對象生成json對象時,若是使用[]操做符取數據,會獲得下面的錯誤 錯誤: Cannot use object of type stdClass as array 產生緣由:php     $res = json_decode($res);     $res['key']; //把 json_decode() 後的對象看成數組使用。json 解決方法(2種)
相關文章
相關標籤/搜索