Home  >  Article  >  Backend Development  >  居然后台自动执行,这是php5.5的更新吗

居然后台自动执行,这是php5.5的更新吗

WBOY
WBOYOriginal
2016-06-13 12:11:20871browse

竟然后台自动执行,这是php5.5的更新吗?
很简单的一段代码

<br />header('Content-Type:text/html;charset=utf-8');<br />date_default_timezone_set('PRC');<br />set_time_limit(0);<br />$date=date("H:i:s");<br />while($date<'11:14:00') //这句测试时要调整一下<br />{<br />$date=date("H:i:s");<br />file_put_contents("test.txt", $date);<br />}<br />


我用浏览器访问,按以前的经验如果运行后关闭浏览器,程序就应该停止了,除非使用ignore_user_abort(true);。
但这两天把系统环境更新成apache2.4+php5.5时,就发现了以上疑问,即使关闭浏览器程序任然运行,直到设定时间到为止。
是我以往理解的概念问题,还是更新后的设置问题,还是其他?
------解决思路----------------------
那你的经验是错误的!
按 php 的描述:
当远程用户点击 STOP 按钮后,脚本再次尝试输出数据时,PHP 将会检测到连接已被中断,并调用关闭触发函数。 

由于你的程序中没有输出,所以 php 不会检测到用户已离线,程序将继续运行

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