博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PHP 从数组对象中取出数组提示:Undefined property: stdClass::$subject
阅读量:6862 次
发布时间:2019-06-26

本文共 562 字,大约阅读时间需要 1 分钟。

是由于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

你可能感兴趣的文章