Home >Backend Development >PHP Tutorial > php popen兑现多任务

php popen兑现多任务

WBOY
WBOYOriginal
2016-06-13 13:11:26869browse

php popen实现多任务

<?php $update_num = 1000;
$limit = 100;
$p_num = 0;

$line_cmd = 'ps -ef | grep doit.php | grep -v grep | wc -l';
$exec_cmd = '/usr/local/php/bin/php doit.php %s & > /dev/null 2>&1';

$t1 = microtime(1);
for($i = 0 ; $i 


<?php sleep(2);
$fp = fopen('doit.txt','a');
fwrite($fp,$argv[1]."\n");
fclose($fp);
exit(0);
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn