Rob*_*cks 6 php scripting webserver asynchronous http
PHP脚本如何启动另一个PHP脚本,然后退出,让另一个脚本运行?
另外,第二个脚本是否有任何方法在PHP脚本到达特定行时通知它?
这是怎么做的.您告诉浏览器读取输出的前N个字符,然后关闭连接,同时脚本一直运行直到完成.
<?php
ob_end_clean();
header("Connection: close");
ignore_user_abort(); // optional
ob_start();
echo ('Text the user will see');
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush(); // Will not work
flush(); // Unless both are called !
// At this point, the browser has closed connection to the web server
// Do processing here
include('other_script.php');
echo('Text user will never see');
?>
Run Code Online (Sandbox Code Playgroud)