我有一个php脚本example1.php
当我从example1.php调用另一个php脚本example2.php时,控制流会是什么样子。
例如example1.php如下所示
....
...
....
shell_exec("php -q example2.php") (calling example2.php from example1.php)
.....
.....控制流是如何做到这一点的?example1.php是等待example2.php完成执行,然后继续其余的代码逻辑,还是继续允许example2.php独立运行?
谢谢!
发布于 2013-10-08 04:11:52
shell_exec()执行外壳命令并等待其完成。您正在运行的命令是php,这一点无关紧要。
发布于 2013-10-08 04:23:55
如果你有test1.php:
echo "test1";
include("test2.php");
echo "test3";和test2.php
for ($i = 1; $i <= 10000; $i++) {
}
echo "test2";结果将是: test1 test2 test3
但是,include之后的代码将在include进程完成后执行。
https://stackoverflow.com/questions/19233691
复制相似问题