您的位置:首页 > 编程语言 > PHP开发

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

2016-08-09 23:49 501 查看
参考: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',

        ],

........
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  yii php web 安装 错误
相关文章推荐