简体   繁体   中英

Yii Framework 2.0 Console Application Error Unknown Property enableCookieValidation

I am learning how to create console application with Yii 2.0. I have downloaded the Yii advanced package 2.0 which already has the default console application in it. I have copied that console application and pasted in my project. In that console application I have a TestController and an actionIndex() method, very basic following the documentation of Yii 2.0. When I run the command within my project:

php yii test

I've got the following error:

 Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request::enableCookieValidation'

When I run the same command in the downloaded Yii advanced application. It works fine. I don't know what causes the error in my project and where to check it. Does anyone have a clue? If you ask how my console application look like, it is literally copied from the Yii 2.0 advanced application. If I run:

php yii migrate

I get the same error.

Seems like you having this line in your console application config:

'request' => [
   'enableCookieValidation' => ...
],

You should delete it because yii\\console\\Request compared to yii\\web\\Request simply doesn't have that property.

Rememeber that in Yii advanced template, there are three settings instances; common/config is the first instance, after that , many of these properties override

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM