laravel 4:没有用工匠生成密钥
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16818804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel 4: key not being generated with artisan
提问by kriek
When running
跑步时
php artisan key:generate
php工匠密钥:生成
I can see the generated key in my shell, but the variable 'key' in app.php remains empty.
我可以在我的 shell 中看到生成的密钥,但 app.php 中的变量“key”仍然为空。
Running on localhost with windows-apache-php 5.4 - mysql.
使用 windows-apache-php 5.4 在本地主机上运行 - mysql。
Never had this problem before with laravel 4 beta version.
Laravel 4 测试版以前从未遇到过这个问题。
回答by Richard Bagshaw
Had the same problem ...
有同样的问题...
- Opened app.php
- Remove the entry that says 'YourSecretKey!!!'
- Ran 'php artisan key:generate'
- 打开 app.php
- 删除显示“YourSecretKey!!!”的条目
- 跑'php artisan key:generate'
Showed me a key in the console, but nothing in app.php
!
在控制台中向我展示了一个键,但没有app.php
!
Solution is ... unlike Laravel 3, don't delete the default YourSecretKey
!!! in app.php
, just run the command and it will work.
解决方案是...不像Laravel 3,不要删除默认值YourSecretKey
!!!在 中app.php
,只需运行该命令即可。
Hope this helps.
希望这可以帮助。
Bagwaa
巴格瓦
回答by Iman Mohamadi
You should not remove the original key, just go to your project directory and run
您不应该删除原始密钥,只需转到您的项目目录并运行
php artisan key:generate
it will work if you don't touch the previous key.
如果您不触摸上一个键,它将起作用。
回答by Sagiruddin Mondal
first type any 32 character like 'hyhyhGGyhyhyhyhy23hyhy23hyhy23hy' this and then re execute the command in terminal/cmd.
首先键入任何 32 个字符,如“hyhyhGGyhyhyhyhy23hyhy23hyhy23hy”,然后在终端/cmd 中重新执行命令。
Step 1:
第1步:
go to app ---> Config --> app.php
转到应用程序 ---> 配置 --> app.php
step 2:
第2步:
'key' => '10101010101010101010101010101010', type any 32 digit or character in that place.
'key' => '10101010101010101010101010101010',在该位置输入任意 32 位数字或字符。
step 3:
第 3 步:
go to terminal / cmd & type : "php artisan key:generate" press enter
转到终端/ cmd 并输入:“php artisan key:generate”按回车
step 4:
第四步:
see the key has been changed :)
查看密钥已更改:)
[ It is because in Laravel 4 By using "php artisan key:generate" we simply can replace the default key any time. But if it is an empty space it can not be able to hold the place. ]
[ 这是因为在 Laravel 4 中通过使用“php artisan key:generate”,我们可以随时替换默认密钥。但如果是空地,就容不下这个地方。]
Enjoy coding :) \m/
享受编码 :) \m/
回答by tirta keniten
Have the same problem with L6 on Windows with xampp.
使用 xampp 在 Windows 上使用 L6 也有同样的问题。
- Remove the cached config
php artisan config:clear
- Regenerate key
php artisan key:generate
- 删除缓存的配置
php artisan config:clear
- 重新生成密钥
php artisan key:generate
Hope it helps.
希望能帮助到你。
回答by John Magnolia
The key generator will only update the APP_KEY in the .env
file.
密钥生成器只会更新.env
文件中的 APP_KEY 。
'key' => env('APP_KEY', 'YourSecretKey'),
config/app.php this is reading the APP_KEY from your .env
file. The second parameter is a fallback.
config/app.php 这是从你的.env
文件中读取 APP_KEY 。第二个参数是回退。
回答by FNunez
I was having the same issue. From my project directory I noticed I had the .env file, when I opened the project in atom (my code editor) I noticed that file appeared as .env.txt, I removed the .txt part and ran the command. It worked for me.
我遇到了同样的问题。从我的项目目录中,我注意到我有 .env 文件,当我在 atom(我的代码编辑器)中打开项目时,我注意到该文件显示为 .env.txt,我删除了 .txt 部分并运行了命令。它对我有用。