在我的main.php
中我有这个代码
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'Da\User\AuthClient\Google',
'clientId' => 'xxxxxxxxxxxxxxxxxapps.googleusercontent.com',
'clientSecret' => 'xxxxxxxxxxxxxxxx',
'returnUrl' => Url::to(['user/security/auth', 'authclient' => 'google']], true),
],
但我得到这个错误。
Notice: Trying to get property 'controller' of non-object in C:\xampp\htdocs\yii2\vendor\yiisoft\yii2\helpers\BaseUrl.php on line 136
我也试过\Yii::$app->urlManager->createAbsoluteUrl('user/security/auth', ['authclient' => 'google']),
并得到此错误
Notice: Trying to get property 'urlManager' of non-object in C:\xampp\htdocs\yii2\frontend\config\main.php on line 160
我如何在main.php中设置一个绝对网址?谢谢
1条答案
按热度按时间o2rvlv0m1#
您可以覆盖
returnUrl
或main.php
中on beforeRequest
节中的其他组件配置参考链接