按照网上的方法,使用composer下载的扩展,控制器中的方法是
public function actions()
{
return [
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'],
],
];
}
结果是报错
HTTP Client Exception – yii\httpclient\ExceptionUnable to detect format for content parsing. Raw response:Http-Code: 200
Server: tws
Date: Tue, 25 Apr 2017 08:38:20 GMT
Content-Type: text/html
Content-Length: 83
Connection: close
Cache-Control: no-cache
收起callback( {"client_id":"102392641","openid":"FBB8382ABCAC6BCBCF6B9411B26D1C1B"} );
public function actions()
{
return [
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'],
],
];
}
结果是报错
HTTP Client Exception – yii\httpclient\ExceptionUnable to detect format for content parsing. Raw response:Http-Code: 200
Server: tws
Date: Tue, 25 Apr 2017 08:38:20 GMT
Content-Type: text/html
Content-Length: 83
Connection: close
Cache-Control: no-cache
收起callback( {"client_id":"102392641","openid":"FBB8382ABCAC6BCBCF6B9411B26D1C1B"} );
public function successCallback($client)
{
$id = $client->getId();
$attributes = $client->getUserAttributes();
var_dump($id, $attributes);
}