$dir = "./$time/";
$info = deepScanDir($dir);
for($i=0; $i system("/usr/sbin/php temp.php \($i\).txt output\($i\).txt");
}
deepScanDir是迴圈檔案夾下的所有檔案。
現在這個迴圈一次執行一次這個命令,我想弄一個,迴圈一次執行很多個命令,相當於多進程吧。多謝了!
回複討論(解決方案)
system("/usr/sbin/php temp.php \($i\).txt output\($i\).txt &");
就不會等待完成了
system("/usr/sbin/php temp.php \($i\).txt output\($i\).txt &");
就不會等待完成了
不行啊,還是一個檔案一個檔案讀。不是多個。
一個檔案一個檔案讀 是必然的,但命名執行在後台已經是並行的了
當然也要看命令和程式是否支援並行了
方便加您個QQ我跟您說一下嗎,我弄了快一天了。。
一個檔案一個檔案讀 是必然的,但命名執行在後台已經是並行的了
當然也要看命令和程式是否支援並行了
[fjg@leona html]$ ps aux|grep php
fjg 13997 0.0 0.0 146968 8008 pts/13 S 16:53 0:00 /usr/sbin/php temp.php (0).txt output(0).txt
fjg 16668 0.0 0.0 146972 7948 pts/13 S 16:54 0:00 /usr/sbin/php temp.php (0).txt output(0).txt
fjg 19027 0.0 0.0 146716 7640 pts/13 S 16:54 0:00 /usr/sbin/php temp.php (0).txt output(0).txt
fjg 22115 0.0 0.0 146968 7720 pts/13 S 16:55 0:00 /usr/sbin/php temp.php (0).txt output(0).txt
fjg 28070 0.0 0.0 144860 7324 pts/13 S 16:56 0:00 /usr/sbin/php data.php test.txt
fjg 28075 0.0 0.0 146716 7656 pts/13 S 16:56 0:00 /usr/sbin/php temp.php (0).txt output(0).txt
fjg 28609 0.0 0.0 61152 756 pts/13 S+ 17:11 0:00 grep php
這樣算是多進程了嗎....