以下代码可用于我的开发环境(Ubuntu 14.04桌面)
The following code works on my development environment (Ubuntu 14.04 desktop)
@if(env('APP_ENV') === 'production') // ... something但是由于某些原因,生产环境(ubuntu 14.04服务器)上的刀片视图无法获取env变量.
But for some reason, the blade views on production (ubuntu 14.04 server) aren't getting the env variables.
如果我运行php artisan env,则响应很好:当前应用程序环境:生产
If I run php artisan env the response is just fine: Current application environment: production
数据库连接工作正常.从控制器调用的env()帮助器也可以工作.
The database connection works fine. And the env() helper called from the controllers, also works.
到目前为止我尝试过的事情:
What I tried so far:
php artisan clear:cache php artisan config:cache php artisan clear:cache php artisan view:clear
我也多次重启了Apache,没有结果.
I also restarted apache multiple times, no results.
有什么建议吗? 谢谢!
Any advice? Thanks!
推荐答案所以,我成功了.
php artisan config:clear做到了.
我猜是问题所在:
我第一次运行php artisan config:cache时,我的.env文件具有APP_ENV = local.因此,我必须清除该配置缓存,以获取新的环境变量值.
The first time I run php artisan config:cache my .env file had APP_ENV=local. So I had to clear that config cache in order to get the new env vars values.
更多推荐
Laravel 5.2 {{env('APP
发布评论