简体   繁体   English

我是否需要在Laravel 5.2中设置应用程序密钥

[英]Do I need to set the Application Key in Laravel 5.2

In my app.php file I have this configuration: 在我的app.php文件中,我有这样的配置:

'key' => env('APP_KEY'),

'cipher' => 'AES-256-CBC',

Do I need to seet the encription key (the one that's on the env.php file) or now. 我是否需要输入encription键(env.php文件中的那个)或现在。 The one that's in the env.php file is longer than 32 characters. env.php文件中的那个超过32个字符。

And also in the app.php for configuration is it better if I set the debugging value to true: 而且在配置app.php中,如果我将调试值设置为true会更好:

'debug' => env('APP_DEBUG', true),

Thanks a lot for your help. 非常感谢你的帮助。

Yes you need to set the key. 是的,你需要设置密钥。 You can do it easily by: 您可以通过以下方式轻松完成:

php artisan key:generate

of course, after fresh install composer does it for you and you don't have to change anything. 当然,在全新安装后,作曲家为你做了,你不需要改变任何东西。 You only need to generate the key if you're installing from github/without the use of composer. 如果您在不使用composer的情况下从github /安装,则只需要生成密钥。

Once you have laravel application installed. 一旦安装了laravel应用程序。 The key is generated and updated in .env file. 密钥在.env文件中生成和更新。 No need to set it up in app/config.php . 无需在app/config.php进行设置。

You can set application key two ways. 您可以通过两种方式设置应用密钥。

1. php artisan key:generate

Or 要么

2. Edit config/app.php and change 

'key' => env('APP_KEY', 'XXXXXXX') // key

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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