开启线程:
$php_cli_path = '/usr/bin/php';
$dir_path = dirname(__FILE__)."/".'CheckTaskState.shell.php';
$cmd = "{$php_cli_path} {$dir_path} '".$this->entId."' > /tmp/task.log &";
//echo "\n\n$cmd\n\n";
//开启进程
$out = popen($cmd, "r");
pclose($out);
接收文件:
define("IS_SHELL_RUN", true);
if (!defined("IS_PHP_SHELL_START")) {
define("IS_PHP_SHELL_START", true);
}
include_once dirname(__FILE__) . '/../../Lib/Init.php';
$ent_id = (int)$_SERVER["argv"][1];
$checkObj = new CheckTaskState($ent_id);
$checkObj->run();
class CheckTaskState
{