【问题标题】:Symfony console, file paths, /dev/fd/0 trickSymfony 控制台、文件路径、/dev/fd/0 技巧
【发布时间】:2017-04-20 08:55:54
【问题描述】:

我有自己的 symfony 控制台命令,其中一些以文件名作为参数。

例如。 $ php app/console mycommands:doTheThing /path/to/my/file.txt

我已经尝试使用/dev/fd/0 技巧来代替use a string 此处的文件,但它仍然无法正常工作。

例如。 $ php app/console mycommands:doTheThing php://dev/fd/0 <<<'myFileContents'

有人可以提供任何见解或帮助吗?

【问题讨论】:

    标签: php symfony console heredoc herestring


    【解决方案1】:

    你可以使用process substitution:

    $ php app/console mycommands:doTheThing <(echo "foobar")
    

    【讨论】:

    • 我得到Exception Message: Warning: fopen(/dev/fd/63): failed to open stream: No such file or directory,然后是对fopen的行号的引用。
    猜你喜欢
    • 2010-09-29
    • 1970-01-01
    • 2018-12-27
    • 2010-09-20
    • 1970-01-01
    • 2015-11-21
    • 2010-12-16
    • 1970-01-01
    • 2016-09-02
    相关资源
    最近更新 更多