Debian PHP system()执行两次,而exec()不';T

Debian PHP system()执行两次,而exec()不';T,debian,php,Debian,Php,我有问题: 当我使用system()执行命令时,它会运行2次,但在使用exec()时不会运行 test.php echo "something" . PHP; system(__DIR__ . "/test.php"); // runs 2 times exec(__DIR__ . "/test.php"); // runs 1 time | testSystem.php echo "something" . PHP; system(__DIR__ . "/test.php"); //

我有问题: 当我使用system()执行命令时,它会运行2次,但在使用exec()时不会运行

test.php

echo "something" . PHP;
system(__DIR__ . "/test.php"); // runs 2 times
exec(__DIR__ . "/test.php"); // runs 1 time
|

testSystem.php

echo "something" . PHP;
system(__DIR__ . "/test.php"); // runs 2 times
exec(__DIR__ . "/test.php"); // runs 1 time
testExec.php

echo "something" . PHP;
system(__DIR__ . "/test.php"); // runs 2 times
exec(__DIR__ . "/test.php"); // runs 1 time
我想,您的“系统”调用实际上没有执行两次。根据PHP手册

系统-执行外部程序并显示输出

请与

Php的“system”命令运行“testSystem.Php”脚本,捕捉输出,这是“某物”,而系统命令为您提供的脚本输出(只运行一次)是“某物”

所以事实上,“system”命令只是重复脚本输出,没有运行两次

当然,您可以将testSystem.php更改为将“某物”写入(追加)文本文件。对于每个脚本调用,您可能只会看到一个条目