-1, 'msg'=>'授权码有误']; } if(empty($params['config'])) { return ['status'=>-1, 'msg'=>'配置有误']; } // 获取授权 $url = 'https://developer.toutiao.com/api/apps/jscode2session?appid='.$params['config']['appid'].'&secret='.$params['config']['secret'].'&code='.$params['authcode']; $result = json_decode(file_get_contents($url), true); if(empty($result['openid'])) { return ['status'=>-1, 'msg'=>$result['errmsg']]; } return ['status'=>0, 'msg'=>'授权成功', 'data'=>$result]; } } ?>