47
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPで非同期実行する

Last updated at Posted at 2014-04-18
//Windowsの場合はpopen関数で非同期実行
if (strpos(PHP_OS, 'WIN')!==false) {
	//「start」コマンドで非同期実行
	$fp = popen('start php test.php', 'r');
	pclose($fp);
//Linuxの場合はexec関数で非同期実行
} else {
	//「>」で出力先指定(*出力先はnullなので出力しない)
	//「&」で非同期実行
	exec('php test.php > /dev/null &');
}
47
55
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
47
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?