如何使用PHP运行另一个PHP脚本?

时间:2011-12-08 22:52:56

标签: php

  

可能重复:
  How to call another PHP script from a PHP script?

我想使用PHP在目录中运行所有PHP脚本。这就是我所拥有的:

foreach(glob('*.php') as $file)
  // Run $file

2 个答案:

答案 0 :(得分:0)

看看exec。你可以这样做:

exec('/usr/bin/php ' . $file); 

答案 1 :(得分:0)

假设POSIX系统

exec("nohup php $file >/dev/null 2>&1 &");