@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'state' => $this->config['state'], |
30 | 30 | 'nonce' => md5(uniqid()), |
31 | 31 | ]; |
32 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
32 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | $this->getToken(); |
70 | 70 | |
71 | 71 | $headers = [ |
72 | - 'Authorization: Bearer ' . $this->token['access_token'], |
|
72 | + 'Authorization: Bearer '.$this->token['access_token'], |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | $data = $this->get($this->UserInfoURL, [], $headers); |
76 | 76 | $data = json_decode($data, true); |
77 | 77 | |
78 | 78 | if (!isset($data['sub'])) { |
79 | - throw new OAuthException('获取Yahoo用户信息失败:' . json_encode($data)); |
|
79 | + throw new OAuthException('获取Yahoo用户信息失败:'.json_encode($data)); |
|
80 | 80 | } |
81 | 81 | return $data; |
82 | 82 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ]; |
97 | 97 | |
98 | 98 | $headers = [ |
99 | - 'Authorization: Basic ' . base64_encode($this->config['app_id'] . ':' . $this->config['app_secret']), |
|
99 | + 'Authorization: Basic '.base64_encode($this->config['app_id'].':'.$this->config['app_secret']), |
|
100 | 100 | 'Content-Type: application/x-www-form-urlencoded', |
101 | 101 | ]; |
102 | 102 | |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | if (isset($data['access_token'])) { |
115 | 115 | return $data; |
116 | 116 | } |
117 | - throw new OAuthException('获取Yahoo access_token 出错:' . json_encode($data)); |
|
117 | + throw new OAuthException('获取Yahoo access_token 出错:'.json_encode($data)); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'app_id' => 'wx6ca7410f8******', |
34 | 34 | 'app_secret' => '30a206b87b7689b19f11******', |
35 | 35 | 'callback' => $callback, |
36 | - 'scope' => 'snsapi_userinfo',//静默授权=>snsapi_base;获取用户信息=>snsapi_userinfo |
|
36 | + 'scope' => 'snsapi_userinfo', //静默授权=>snsapi_base;获取用户信息=>snsapi_userinfo |
|
37 | 37 | //'proxy_url' => 'http://www.abc.com/wx_proxy.php',//如果不需要代理请注释此行 |
38 | 38 | //'proxy_url' => 'http://www.abc.com/weixin-authorize-proxy.html',//如果不需要代理请注释此行 |
39 | 39 | ], |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'type' => 'applets', |
53 | 53 | ], |
54 | 54 | ], |
55 | - 'wecom' => [ // 企业微信 |
|
55 | + 'wecom' => [// 企业微信 |
|
56 | 56 | 'app_id' => 'ww1234567890******', |
57 | 57 | 'app_secret' => 'abcdefghijklmn******', |
58 | 58 | 'callback' => $callback, |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | 'douyin'=>[ |
68 | 68 | //抖音官方:请确保授权回调域网站协议为 https |
69 | 69 | 'pc'=>[ |
70 | - 'oauth_type' => \tinymeng\OAuth2\Helper\ConstCode::TYPE_DOUYIN,//抖音douyin,头条toutiao,西瓜xigua,使用\tinymeng\OAuth2\Helper\ConstCode |
|
70 | + 'oauth_type' => \tinymeng\OAuth2\Helper\ConstCode::TYPE_DOUYIN, //抖音douyin,头条toutiao,西瓜xigua,使用\tinymeng\OAuth2\Helper\ConstCode |
|
71 | 71 | 'app_id' => 'awenvxxxxxxxx7x4', |
72 | 72 | 'app_secret' => '5cfbc25badxxxxxxxc7be8c1', |
73 | 73 | 'callback' => 'https://majiameng.com/app/douyin', |
74 | - 'scope' => 'trial.whitelist,user_info',//trial.whitelist为白名单人员权限,上线后删掉 |
|
75 | - 'optionalScope' => '',//应用授权可选作用域,多个授权作用域以英文逗号(,)分隔,每一个授权作用域后需要加上一个是否默认勾选的参数,1为默认勾选,0为默认不勾选 |
|
74 | + 'scope' => 'trial.whitelist,user_info', //trial.whitelist为白名单人员权限,上线后删掉 |
|
75 | + 'optionalScope' => '', //应用授权可选作用域,多个授权作用域以英文逗号(,)分隔,每一个授权作用域后需要加上一个是否默认勾选的参数,1为默认勾选,0为默认不勾选 |
|
76 | 76 | ], |
77 | 77 | 'mobile'=>[ |
78 | 78 | //待完善TODO... |
79 | 79 | 'app_id' => 'awenvxxxxxxxx7x4', |
80 | 80 | 'app_secret' => '5cfbc25badxxxxxxxc7be8c1', |
81 | 81 | 'callback' => 'https://majiameng.com/app/douyin', |
82 | - 'scope' => 'login_id',//login_id为静默授权 |
|
82 | + 'scope' => 'login_id', //login_id为静默授权 |
|
83 | 83 | ], |
84 | 84 | 'app'=>[ |
85 | 85 | //待完善TODO... |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | 'app_id' => '1234567890', |
172 | 172 | 'app_secret' => 'abcdefgh******', |
173 | 173 | 'callback' => $callback, |
174 | - 'scope' => 'public_profile,user_gender',//user_gender需要审核,所以不一定能获取到 |
|
174 | + 'scope' => 'public_profile,user_gender', //user_gender需要审核,所以不一定能获取到 |
|
175 | 175 | ], |
176 | 176 | 'twitter' => [ |
177 | 177 | 'app_id' => 'abcdefgh******', |
@@ -30,11 +30,11 @@ |
||
30 | 30 | } |
31 | 31 | } else { |
32 | 32 | $arr = $oauth->login($type); |
33 | - if (isset($arr['code']) && $arr['code'] == 0) { |
|
34 | - exit("<script language='javascript'>window.location.href='{$arr['url']}';</script>"); |
|
35 | - } elseif (isset($arr['code'])) { |
|
36 | - exit('登录接口返回:' . $arr['msg']); |
|
37 | - } else { |
|
38 | - exit('获取登录地址失败'); |
|
39 | - } |
|
33 | + if (isset($arr['code']) && $arr['code'] == 0) { |
|
34 | + exit("<script language='javascript'>window.location.href='{$arr['url']}';</script>"); |
|
35 | + } elseif (isset($arr['code'])) { |
|
36 | + exit('登录接口返回:' . $arr['msg']); |
|
37 | + } else { |
|
38 | + exit('获取登录地址失败'); |
|
39 | + } |
|
40 | 40 | } |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | exit("<script language='javascript'>window.location.href='./';</script>"); |
25 | 25 | |
26 | 26 | } elseif (isset($arr['code'])) { |
27 | - exit('登录失败,返回错误原因:' . $arr['msg']); |
|
27 | + exit('登录失败,返回错误原因:'.$arr['msg']); |
|
28 | 28 | } else { |
29 | 29 | exit('获取登录数据失败'); |
30 | 30 | } |
31 | - }catch (\Exception $exception){ |
|
31 | + } catch (\Exception $exception) { |
|
32 | 32 | echo $exception->getFile(); |
33 | 33 | echo $exception->getLine(); |
34 | 34 | echo $exception->getMessage(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if (isset($arr['code']) && $arr['code'] == 0) { |
40 | 40 | exit("<script language='javascript'>window.location.href='{$arr['url']}';</script>"); |
41 | 41 | } elseif (isset($arr['code'])) { |
42 | - exit('登录接口返回:' . $arr['msg']); |
|
42 | + exit('登录接口返回:'.$arr['msg']); |
|
43 | 43 | } else { |
44 | 44 | exit('获取登录地址失败'); |
45 | 45 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | } else { |
29 | 29 | exit('获取登录数据失败'); |
30 | 30 | } |
31 | - }catch (\Exception $exception){ |
|
31 | + } catch (\Exception $exception){ |
|
32 | 32 | echo $exception->getFile(); |
33 | 33 | echo $exception->getLine(); |
34 | 34 | echo $exception->getMessage(); |
@@ -24,16 +24,16 @@ |
||
24 | 24 | <div class="list-group"> |
25 | 25 | <?php foreach ($_SESSION['user'] as $key => $value):?> |
26 | 26 | <div class="form-group"> |
27 | - <label><?php echo $key;?>:</label> |
|
28 | - <?php if(is_array($value)):?> |
|
27 | + <label><?php echo $key; ?>:</label> |
|
28 | + <?php if (is_array($value)):?> |
|
29 | 29 | <textarea rows="5" class="form-control" readonly="readonly"> |
30 | 30 | <?php echo json_encode($value); ?> |
31 | 31 | </textarea> |
32 | 32 | <?php else:?> |
33 | 33 | <input type="text" value="<?php echo $value; ?>" class="form-control" readonly="readonly"/> |
34 | - <?php endif;?> |
|
34 | + <?php endif; ?> |
|
35 | 35 | </div> |
36 | - <?php endforeach;?> |
|
36 | + <?php endforeach; ?> |
|
37 | 37 | </div> |
38 | 38 | </div> |
39 | 39 | </div> |
@@ -29,8 +29,11 @@ |
||
29 | 29 | <textarea rows="5" class="form-control" readonly="readonly"> |
30 | 30 | <?php echo json_encode($value); ?> |
31 | 31 | </textarea> |
32 | - <?php else:?> |
|
33 | - <input type="text" value="<?php echo $value; ?>" class="form-control" readonly="readonly"/> |
|
32 | + <?php else { |
|
33 | + :?> |
|
34 | + <input type="text" value="<?php echo $value; |
|
35 | +} |
|
36 | +?>" class="form-control" readonly="readonly"/> |
|
34 | 37 | <?php endif;?> |
35 | 38 | </div> |
36 | 39 | <?php endforeach;?> |
@@ -10,20 +10,20 @@ |
||
10 | 10 | //引入配置文件 |
11 | 11 | $params = require('../config/params.php'); |
12 | 12 | |
13 | -try{ |
|
14 | - $name="qq";//登录类型,例:qq / google |
|
13 | +try { |
|
14 | + $name = "qq"; //登录类型,例:qq / google |
|
15 | 15 | $oauth = new oauth2($params); |
16 | 16 | if (empty($_GET['code'])) { |
17 | 17 | /** 登录 */ |
18 | 18 | $result = $oauth->login($name); |
19 | 19 | // var_dump($result['url']);die; |
20 | 20 | //重定向到第三方登录页 |
21 | - header('Location: ' . $result['url']); |
|
22 | - }else{ |
|
21 | + header('Location: '.$result['url']); |
|
22 | + } else { |
|
23 | 23 | /** 登录回调 */ |
24 | 24 | $result = $this->callback($name); |
25 | - var_dump($result);die; |
|
25 | + var_dump($result); die; |
|
26 | 26 | } |
27 | -}catch(Exception $e){ |
|
27 | +} catch (Exception $e) { |
|
28 | 28 | echo 'Oauth登录失败!'.$e->getMessage(); |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -19,11 +19,11 @@ |
||
19 | 19 | // var_dump($result['url']);die; |
20 | 20 | //重定向到第三方登录页 |
21 | 21 | header('Location: ' . $result['url']); |
22 | - }else{ |
|
22 | + } else{ |
|
23 | 23 | /** 登录回调 */ |
24 | 24 | $result = $this->callback($name); |
25 | 25 | var_dump($result);die; |
26 | 26 | } |
27 | -}catch(Exception $e){ |
|
27 | +} catch(Exception $e){ |
|
28 | 28 | echo 'Oauth登录失败!'.$e->getMessage(); |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'scope' => $this->config['scope'], |
42 | 42 | 'state' => $this->config['state'], |
43 | 43 | ]; |
44 | - return self::AUTHORIZE_URL . '?' . http_build_query($params); |
|
44 | + return self::AUTHORIZE_URL.'?'.http_build_query($params); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'avatar' => $result['picture'], |
71 | 71 | 'native' => $result, |
72 | 72 | ); |
73 | - if(isset($result['email'])){ |
|
73 | + if (isset($result['email'])) { |
|
74 | 74 | $userInfo['email'] = $result['email']; |
75 | 75 | } |
76 | 76 | return $userInfo; |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getUserInfo() |
83 | 83 | { |
84 | - if($this->type == 'app'){//App登录 |
|
85 | - if(!isset($_REQUEST['code']) ){ |
|
84 | + if ($this->type == 'app') {//App登录 |
|
85 | + if (!isset($_REQUEST['code'])) { |
|
86 | 86 | throw new OAuthException("Google APP登录 需要传输code参数! "); |
87 | 87 | } |
88 | 88 | } |
89 | 89 | $this->getToken(); |
90 | - $headers = ['Authorization: Bearer ' . $this->token['access_token']]; |
|
91 | - $data = $this->get(self::API_BASE . 'oauth2/v2/userinfo', '', $headers); |
|
90 | + $headers = ['Authorization: Bearer '.$this->token['access_token']]; |
|
91 | + $data = $this->get(self::API_BASE.'oauth2/v2/userinfo', '', $headers); |
|
92 | 92 | return json_decode($data, true); |
93 | 93 | } |
94 | 94 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (!$config) { |
113 | 113 | throw new OAuthException('传入的配置不能为空'); |
114 | 114 | } |
115 | - if(isset($_GET['referer']) && $config['callback']){ |
|
115 | + if (isset($_GET['referer']) && $config['callback']) { |
|
116 | 116 | $config['callback'] .= ((strpos($config['callback'], '?') !== false) ? '&' : '?').'referer='.$_GET['referer']; |
117 | 117 | } |
118 | 118 | //默认参数 |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | 'proxy' => '', |
126 | 126 | 'state' => '', |
127 | 127 | 'type' => '', |
128 | - 'is_sandbox' => false,//是否是沙箱环境 |
|
128 | + 'is_sandbox' => false, //是否是沙箱环境 |
|
129 | 129 | ]; |
130 | - $this->config = array_merge($_config, $config); |
|
131 | - foreach($this->config as $key=>$val){ |
|
132 | - if(property_exists($this,$key)) $this->$key=$val; |
|
130 | + $this->config = array_merge($_config, $config); |
|
131 | + foreach ($this->config as $key=>$val) { |
|
132 | + if (property_exists($this, $key)) $this->$key = $val; |
|
133 | 133 | } |
134 | 134 | $this->timestamp = time(); |
135 | 135 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * Updater: |
166 | 166 | * @return $this |
167 | 167 | */ |
168 | - public function mustCheckState(){ |
|
168 | + public function mustCheckState() { |
|
169 | 169 | $this->checkState = true; |
170 | 170 | return $this; |
171 | 171 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @Author: TinyMeng <[email protected]> |
176 | 176 | * @return array |
177 | 177 | */ |
178 | - public function getConfig(){ |
|
178 | + public function getConfig() { |
|
179 | 179 | return $this->config; |
180 | 180 | } |
181 | 181 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param $token |
185 | 185 | * @return $this |
186 | 186 | */ |
187 | - public function setToken($token){ |
|
187 | + public function setToken($token) { |
|
188 | 188 | $this->token = $token; |
189 | 189 | return $this; |
190 | 190 | } |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | * 存储state |
194 | 194 | * @Author: TinyMeng <[email protected]> |
195 | 195 | */ |
196 | - public function saveState(){ |
|
196 | + public function saveState() { |
|
197 | 197 | if ($this->checkState === true) { |
198 | 198 | //是否开启session |
199 | 199 | if (session_status() !== PHP_SESSION_ACTIVE) { |
200 | 200 | session_start(); |
201 | 201 | } |
202 | - if(empty($this->config['state'])){ |
|
203 | - $this->config['state'] = Str::random();//生成随机state |
|
202 | + if (empty($this->config['state'])) { |
|
203 | + $this->config['state'] = Str::random(); //生成随机state |
|
204 | 204 | } |
205 | 205 | //存储到session |
206 | 206 | $_SESSION['tinymeng_oauth_state'] = $this->config['state']; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @Author: TinyMeng <[email protected]> |
213 | 213 | * @throws OAuthException |
214 | 214 | */ |
215 | - public function checkState(){ |
|
215 | + public function checkState() { |
|
216 | 216 | if ($this->checkState === true) { |
217 | 217 | if (session_status() !== PHP_SESSION_ACTIVE) { |
218 | 218 | session_start(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @author: JiaMeng <[email protected]> |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public function getCode(){ |
|
232 | + public function getCode() { |
|
233 | 233 | return isset($_REQUEST['code']) ? $_REQUEST['code'] : ''; |
234 | 234 | } |
235 | 235 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * Updater: |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - protected function accessTokenParams(){ |
|
242 | + protected function accessTokenParams() { |
|
243 | 243 | $params = [ |
244 | 244 | 'client_id' => $this->config['app_id'], |
245 | 245 | 'client_secret' => $this->config['app_secret'], |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @author: JiaMeng <[email protected]> |
256 | 256 | * Updater: |
257 | 257 | */ |
258 | - protected function getToken(){ |
|
258 | + protected function getToken() { |
|
259 | 259 | if (empty($this->token)) { |
260 | 260 | /** 验证state参数 */ |
261 | 261 | $this->checkState(); |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | $params = $this->accessTokenParams(); |
265 | 265 | |
266 | 266 | /** 获取access_token */ |
267 | - $token = $this->post($this->AccessTokenURL, $params,$this->getHeaders()); |
|
267 | + $token = $this->post($this->AccessTokenURL, $params, $this->getHeaders()); |
|
268 | 268 | /** 解析token值(子类实现此方法) */ |
269 | 269 | $this->token = $this->parseToken($token); |
270 | - }else{ |
|
270 | + } else { |
|
271 | 271 | return $this->token; |
272 | 272 | } |
273 | 273 | } |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * M代表男性,F代表女性 |
278 | 278 | * @param $gender |
279 | 279 | */ |
280 | - public function getGender($gender){ |
|
281 | - return strtolower(substr($gender , 0 , 1)) == 'm' ? ConstCode::GENDER_MAN : ConstCode::GENDER_WOMEN; |
|
280 | + public function getGender($gender) { |
|
281 | + return strtolower(substr($gender, 0, 1)) == 'm' ? ConstCode::GENDER_MAN : ConstCode::GENDER_WOMEN; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 |
@@ -129,7 +129,9 @@ discard block |
||
129 | 129 | ]; |
130 | 130 | $this->config = array_merge($_config, $config); |
131 | 131 | foreach($this->config as $key=>$val){ |
132 | - if(property_exists($this,$key)) $this->$key=$val; |
|
132 | + if(property_exists($this,$key)) { |
|
133 | + $this->$key=$val; |
|
134 | + } |
|
133 | 135 | } |
134 | 136 | $this->timestamp = time(); |
135 | 137 | } |
@@ -267,7 +269,7 @@ discard block |
||
267 | 269 | $token = $this->post($this->AccessTokenURL, $params,$this->getHeaders()); |
268 | 270 | /** 解析token值(子类实现此方法) */ |
269 | 271 | $this->token = $this->parseToken($token); |
270 | - }else{ |
|
272 | + } else{ |
|
271 | 273 | return $this->token; |
272 | 274 | } |
273 | 275 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function get($url, $params = [], $headers = []) |
37 | 37 | { |
38 | - return HttpRequest::httpGet($url, $params,$headers); |
|
38 | + return HttpRequest::httpGet($url, $params, $headers); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function post($url, $params = [], $headers = []) |
51 | 51 | { |
52 | - return HttpRequest::httpPost($url, $params,$headers); |
|
52 | + return HttpRequest::httpPost($url, $params, $headers); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -129,7 +129,7 @@ |
||
129 | 129 | |
130 | 130 | /** 解析token值 */ |
131 | 131 | $this->token = $this->parseToken($token); |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | return $this->token; |
134 | 134 | } |
135 | 135 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'scope' => $this->config['scope'], |
40 | 40 | 'state' => $this->config['state'] ?: Str::random(), |
41 | 41 | ]; |
42 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
42 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'channel' => ConstCode::TYPE_LINE, |
66 | 66 | 'nickname' => $result['displayName'], |
67 | 67 | 'gender' => ConstCode::GENDER, //line不返回性别信息 |
68 | - 'avatar' => isset($result['pictureUrl']) ? $result['pictureUrl'] . '/large' : '', |
|
68 | + 'avatar' => isset($result['pictureUrl']) ? $result['pictureUrl'].'/large' : '', |
|
69 | 69 | 'native' => $result, |
70 | 70 | ]; |
71 | 71 | return $userInfo; |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | $method = strtoupper($method); |
100 | 100 | $request = [ |
101 | 101 | 'method' => $method, |
102 | - 'uri' => self::API_BASE . $api, |
|
102 | + 'uri' => self::API_BASE.$api, |
|
103 | 103 | ]; |
104 | 104 | |
105 | - $headers = ['Authorization: ' . $this->token['token_type'] . ' ' . $this->token['access_token']]; |
|
105 | + $headers = ['Authorization: '.$this->token['token_type'].' '.$this->token['access_token']]; |
|
106 | 106 | |
107 | 107 | $data = $this->$method($request['uri'], $params, $headers); |
108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @author: JiaMeng <[email protected]> |
116 | 116 | * Updater: |
117 | 117 | */ |
118 | - protected function getToken(){ |
|
118 | + protected function getToken() { |
|
119 | 119 | if (empty($this->token)) { |
120 | 120 | /** 验证state参数 */ |
121 | 121 | $this->checkState(); |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | $params = http_build_query($params); |
126 | 126 | |
127 | 127 | /** 获取access_token */ |
128 | - $token = $this->post($this->AccessTokenURL, $params,$this->getHeaders()); |
|
128 | + $token = $this->post($this->AccessTokenURL, $params, $this->getHeaders()); |
|
129 | 129 | |
130 | 130 | /** 解析token值 */ |
131 | 131 | $this->token = $this->parseToken($token); |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | return $this->token; |
134 | 134 | } |
135 | 135 | } |