Laravel config/app.php没有更新

Meh*_*kri 6 configuration-files laravel laravel-5

在laravel 5中,config/app.php我将语言环境设置为'ar',但在尝试通过以下方式获取代码中的语言环境时: config('app.locale');

我仍然得到'en'.似乎config/app.php没有自动加载/更新.

即使config/app.php为空,执行config('app');返回:

array:10 [?
"debug" => true
"url" => "http://localhost"
"timezone" => "UTC"
"locale" => "en"
"fallback_locale" => "en"
"key" => "XXXXXXXXXXXXXXXXXXXXXXX" // changed here
"cipher" => "AES-256-CBC"
"log" => "single"
"providers" => array:31 [?]
"aliases" => array:36 [?]]
Run Code Online (Sandbox Code Playgroud)

一些提示将不胜感激.

Meh*_*kri 26

似乎缓存了配置设置.使用php artisan config:clear


raf*_*nes 8

只是一个小的附加说明。如果您正在运行本地服务器localhost:8000php artisan serve并且您对.env文件或配置文件进行了更改,即使使用已接受答案中的步骤清除配置缓存后,它也不会更新。

您需要停止本地服务器(终端中的 control + c)并运行php artisan serve以再次启动它 - 然后您的更改会被接收。