这是我的代码
sample.php
//Background execution
function execInBackground($cmd)
{
if (substr(php_uname(), 0, 7) == "Windows") {
pclose(popen("start /B " . $cmd, "r"));
} else {
exec($cmd . " > /dev/null &");
}
}
和
execInBackground('php -f ' . SITE_PATH . 'admin/background_process.php live_import');
background_process.php
if($argv[1]=='live_import') {
...
...
some functionalities
}
它的工作正常,但在background_process.php中,如果我包含另一个文件,如 background_process.php
if($argv[1]=='live_import') {
include_once('new.php');
}
在new.php中,我有功能代码。但这不起作用。