Laravel 4.2 says my application is in production. How do I turn this off?(Laravel 4.2 说我的应用程序正在生产中.我该如何关闭它?)
问题描述
我全新安装了 Laravel.运行 php artisan migrate:refresh
时,我收到一条消息说 Application In Production!你真的要运行这个命令吗?'
I have a fresh install of Laravel. When running php artisan migrate:refresh
I get a message saying Application In Production! Do you really wish to run this command?'
我知道这是 4.2 的更新,但我不知道如何关闭它.
I know this is an update in 4.2, however I can't figure out how to turn it off.
我在源代码中发现它来自 IlluminateConsoleConfirmableTrait
并在测试通过时运行:if ($this->getLaravel()->environment() == '生产')
I found in the source that it comes from IlluminateConsoleConfirmableTrait
and runs if this if test passes : if ($this->getLaravel()->environment() == 'production')
我不确定为什么它认为我在生产中.我从不设置任何环境.这是我目前仍在使用的默认环境检测.
I'm not sure why it thinks I'm in production. I never setup any environments. This is the default environment detection, which I'm still currently using.
$env = $app->detectEnvironment(array(
'local' => array('homestead')
));
另外,如果我将生产环境设置为不是我的机器的主机名,我仍然会遇到同样的问题.
Also, if I set a production environment to a hostname that isn't my machine, I still have the same problem.
推荐答案
只要指定匹配给定环境的主机名,laravel
会自动检测环境(默认为生产
),例如:
Just specify a machine name for the host that matches a given environment, then laravel
will automatically detect the environment (default is production
), for example:
$env = $app->detectEnvironment(array(
//'local' => array('homestead'),
'local' => array('*.dev', gethostname()),
'production' => array('*.com', '*.net', 'www.somedomain.com')
));
阅读文档 和 这个答案也是如此.
这篇关于Laravel 4.2 说我的应用程序正在生产中.我该如何关闭它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 4.2 说我的应用程序正在生产中.我该如何关闭它?


基础教程推荐
- php中的PDF导出 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- php中的foreach复选框POST 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01