PHP 从数组对象中取出数组提示:Undefined property: stdClass::$subject
生活随笔
收集整理的這篇文章主要介紹了
PHP 从数组对象中取出数组提示:Undefined property: stdClass::$subject
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
是由于PHP增加嚴謹性,首先要加下判斷數組值是否存在,然后在獲取!
? ? ?if (isset($result->access_token)) {
? ? ?}
$curl = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$this->app_id.'&secret='.$this->app_secret.'&code='.$code.'&grant_type=authorization_code';$content = $this->_request($curl);$result = json_decode($content);//先判斷是否有值,然后通過access_token和openid拉取用戶信息if (isset($result->access_token)) {$webAccess_token = $result->access_token;$openid = $result->openid;}
轉載于:https://www.cnblogs.com/weilianguang/p/10990007.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的PHP 从数组对象中取出数组提示:Undefined property: stdClass::$subject的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java笔记javaweb部分
- 下一篇: 12- APP接口测试以及接口文档的分析