Laravel config/app.php 未更新
Laravel config/app.php not updating
在 laravel 5 , config/app.php 我已经将语言环境设置为 'ar'
但是在尝试通过以下方式获取代码中的语言环境时:
config('app.locale');
我仍然得到 'en'。
好像 config/app.php 不是 auto-loaded/updated.
即使config/app.php为空,执行config('app');
returns:
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 [▶]]
一些提示将不胜感激。
似乎已缓存配置设置。使用 php artisan config:clear
只是一个小的补充说明。如果您 运行 使用 php artisan serve
在 localhost:8000
上连接本地服务器并且您对 .env
文件或配置文件进行了更改,即使在使用接受的答案中的步骤,它不会更新。
您需要停止本地服务器(终端中的 control + c),然后 运行 php artisan serve
重新启动它 - 然后您的更改就会生效。
在 laravel 5 , config/app.php 我已经将语言环境设置为 'ar'
但是在尝试通过以下方式获取代码中的语言环境时:
config('app.locale');
我仍然得到 'en'。 好像 config/app.php 不是 auto-loaded/updated.
即使config/app.php为空,执行config('app');
returns:
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 [▶]]
一些提示将不胜感激。
似乎已缓存配置设置。使用 php artisan config:clear
只是一个小的补充说明。如果您 运行 使用 php artisan serve
在 localhost:8000
上连接本地服务器并且您对 .env
文件或配置文件进行了更改,即使在使用接受的答案中的步骤,它不会更新。
您需要停止本地服务器(终端中的 control + c),然后 运行 php artisan serve
重新启动它 - 然后您的更改就会生效。