Php 一次执行多个shell_exec?

Php 一次执行多个shell_exec?,php,shell,shellexecute,shell-exec,Php,Shell,Shellexecute,Shell Exec,如何一次执行多个shell_exec 另外,如何切换每个进程以查看test.php文件的输出?我需要知道每个进程(php文件)在做什么 请看一看,例如: index.php <?php shell_exec("php test.php"); shell_exec("php test.php"); shell_exec("php test.php"); ?> <?php $section = rand(123,123); $x = 1; while($x <= 50) {

如何一次执行多个shell_exec

另外,如何切换每个进程以查看test.php文件的输出?我需要知道每个进程(php文件)在做什么

请看一看,例如:

index.php

<?php
shell_exec("php test.php");
shell_exec("php test.php");
shell_exec("php test.php");
?>
<?php
$section = rand(123,123);
$x = 1;
while($x <= 50) {
 print $section . ": " . $x . "\n";
 $x++;
 sleep(1);
}
?>

这不是我想要的工作方式,必须先完成第一个shell_exec(test.php),然后再转到下一个shell_exec

test.php

<?php
shell_exec("php test.php");
shell_exec("php test.php");
shell_exec("php 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
时,它会输出

还是有办法打开多个壳

这是一个快速的示例,但是我将执行多个PHP文件来运行CURL

shell_exec(“PHP test.PHP&PHP test.PHP”)


您最好将这些脚本记录输出到文件,并在运行shell_exec()后主动解析它。

输出到文件是个好主意,但文件锁定或类似文件已打开没有问题?