これを
<meta http-equiv="refresh" content="1">すると, ソルバ実行中のstdout/stderrをリアルタイムっぽく表示してくれる.
<?php session_start(); if ( isset($_SESSION['status']) && $_SESSION['status'] == 'done' ) { header("Location: result.php"); exit; } if ( isset($_POST['job']) ) { /* execute once */ $command = solve_command(); $buffer = uniq_name(); system($command . " > " . $buffer . " 2>&1 " . "&"); $_SESSION['command'] = $command; $_SESSION['buffer'] = $buffer; $_SESSION['status'] = 'running'; } else { $command = $_SESSION['command']; $buffer = $_SESSION['buffer']; $fp = fopen($buffer, "r"); if ( !$fp ) { die("cannot open buffering file."); } echo "<pre>"; fpassthru($fp); echo "</pre>"; $_SESSION['status'] = 'done'; } ?>
※コメント投稿者のブログIDはブログ作成者のみに通知されます