Laravel 4.2说我的应用程序正在生产中.如何关闭此功能? [英] Laravel 4.2 says my application is in production. How do I turn this off?

查看:355
本文介绍了Laravel 4.2说我的应用程序正在生产中.如何关闭此功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我重新安装了Laravel.运行php artisan migrate:refresh时,我收到一条消息,提示Application In Production! Do you really wish to run this command?'

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.

我在源代码中发现它来自Illuminate\Console\ConfirmableTrait并在测试通过的情况下运行:if ($this->getLaravel()->environment() == 'production')

I found in the source that it comes from Illuminate\Console\ConfirmableTrait 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将自动检测环境(例如,默认为production). :

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')
));

阅读文档 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆