Yii2 isGuest giving exception in console application
问题 In console application when I used Yii::$app->user->isGuest it is giving the below exception: Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown prop erty: yii\console\Application::user' I even tried adding the user in components array in config file. But it didn't worked. Any idea what am I doing wrong? 回答1: In Console application Yii->$app->user does not exist. So, you need to configure user component in config\console.php . like as, config\console.php 'components'