原文链接:Invalid Configuration – yii\base\InvalidConfigException – 每天进步一点点 (longkui.site)
0.背景
搭建yii2框架时,最后一步运行php yii serve.
然后访问localhost:8080,然后就开始报错:
yii\web\Request::cookieValidationKey must be configured with a secret key.
1.解决办法
打开我们yii2框的目录,找到config/web.php。然后找到下面代码:
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '123456',
],
原来cookieValidationKey的值是空,给他改成一个非空值就可以,我测试过true,123456,asdf等字符串,均能正常打开页面,
正常打开网站是下面这样:
标签:cookieValidationKey,yii,Invalid,base,InvalidConfigException,Configuration From: https://www.cnblogs.com/longkui-site/p/16657797.html