watermark->appid != env('WX_APP_ID')) return 5; $data = $result; return true; } public static function codeLogin($code) { $url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . env('WX_APP_ID') . '&secret=' . env('WX_APP_SECRET') . '&js_code=' . $code . '&grant_type=authorization_code'; $info = file_get_contents($url); $json = json_decode($info); return get_object_vars($json); } }