【发布时间】:2011-07-06 00:12:38
【问题描述】:
如何一次执行多个 shell_exec?
另外,如何切换每个进程以查看 test.php 文件的输出?我需要知道每个进程(php 文件)在做什么。
看看,例子:
index.php
<?php
shell_exec("php test.php");
shell_exec("php test.php");
shell_exec("php test.php");
?>
这不符合我的要求,首先必须先完成 shell_exec (test.php),然后再执行下一个 shell_exec。
test.php
<?php
$section = rand(123,123);
$x = 1;
while($x <= 50) {
print $section . ": " . $x . "\n";
$x++;
sleep(1);
}
?>
执行 shell_exec 时不输出,但是当我在 shell 中手动键入 php test.php 时,它会输出。
或者有没有办法打开多个shell?
这是一个简单的示例,但是我将执行多个 PHP 文件来运行 CURL
【问题讨论】:
标签: php shell shellexecute shell-exec