本文介绍了如何在 PHP exec 中使用管道(“|")?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用 CMD 同时执行两个命令:
I can use CMD to execute two commands at the same time using:
command1 | command2
在 PHP 中,我认为它应该可以工作,但它没有:
In PHP, I assumed it should work, but it doesn't:
Shell_exec("command1 | command2 ");
我该如何解决?
推荐答案
尝试加大括号:
shell_exec("(command1 | command2)");
PHP 文档中有 注释使用 popen
进行/O 重定向.
There is a comment in the PHP documentation that does some I/O-redirection with popen
.
这篇关于如何在 PHP exec 中使用管道(“|")?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!