0
点赞
收藏
分享

微信扫一扫

yii\web\Request::cookieValidationKey must be configured with a secret key.


参考:​​http://www.yiiframework.com/forum/index.php/topic/56238-cookievalidationkey-must-be-configured-with-a-secret-key/​​


我的yii2模板是:yii-basic-app-2.0.9.tgz

解压后执行命令:yii serve --port=8888

访问:http://localhost:8888/

出现如下错误:

Invalid Configuration – yii\base\InvalidConfigException

yii\web\Request::cookieValidationKey must be configured with a secret key.----------------------------------------------------------------------------------------------------------------
解决方法:
打开文件config\web.php, 设置 'cookieValidationKey' => 'true',即可,如;
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'true', // 就是这里了
],
'cache' => [
'class' => 'yii\caching\FileCache',
],........

举报

相关推荐

0 条评论