Symfony控制台 - 未定义的常量STDIN

时间:2013-05-01 10:39:03

标签: php symfony

我最近将我的symfony项目上传到了我的webhoster。使用控制台时,每当我想输入一些输入时,我都会收到以下错误。

Notice: Use of undefined constant STDIN - assumed 'STDIN' in 
/htdocs/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/DialogHelper.php line 80

发出错误的文件在这里:

https://github.com/symfony/Console/blob/master/Helper/DialogHelper.php

第103行

我认为我的php配置有点错误。但是我没有完全控制服务器及其设置。

我有什么办法可以解决问题吗?

1 个答案:

答案 0 :(得分:3)

只需添加:

define('STDIN',fopen("php://stdin","r"));

位于/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/DialogHelper.php的顶部

    <?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;

define('STDIN',fopen("php://stdin","r"));
...