Laravel工匠总是认为它在本地 [英] Laravel artisan always thinks its in local
问题描述
我用Laravel Forge设置了几个ENV变量,这些变量可以被应用程序正确地拾取.但是,工匠似乎并没有适应我的环境. php artisan env
返回:
I set several ENV variables with Laravel Forge which are correctly picked up by the application. However artisan doesn't seem to pick up my environment. php artisan env
returns:
Current application environment: local
在nginx配置中,我也有
In the nginx configuration I also have
fastcgi_param ENV "test";
这是我检测环境的方式:
This is how I detect my environment:
$env = $app->detectEnvironment(function () {
return getenv('ENV') ?: 'local';
});
在测试环境中,工匠如何看待它?
How can I have artisan think its in the test environment?
推荐答案
尝试验证您的.env文件是否配置正确.看看您的.env文件并进行以下设置:
Try to verify if your .env file is correctly configured. Take a look in your .env and set this:
APP_ENV=test
之后,尝试清除您的配置.在您的终端中输入以下内容:
after that try to clear your configuration. Type this in your terminal:
php artisan config:clear
并使用以下命令完成环境验证:
and to finish verify your environment with this:
php artisan env
希望对您有所帮助.
致谢!
这篇关于Laravel工匠总是认为它在本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!