set_time_limit 不起作用
来源:互联网 发布:手机淘宝怎么取消好评 编辑:程序博客网 时间:2024/05/01 12:20
visitor 填了表格,提交后(我的php程序要进行一些网络查询,执行时间不可定),如果一段时间没看到结果页面,把页面关闭了,但是我不想php程序退出运行,怎么办?
<?phpset_time_limit(10);sleep(15);echo "test";?>
结果浏览器一段时间后,显示了 test。难道是 set_time_limit 不起作用? 百度搜:set_time_limit 不起作用,找到很多资料,都说 set_time_limit 在windows下不起作用,只有通过修改 php.ini 里的 max_execution_time 的值 来控制执行时间。可我的空间是 linux 系统。
找到 http://blog.csdn.net/mengxiangbaidu/article/details/7305536
http://houbolin.cn/blog/2009/12/31/php-set_time_limit-%E5%92%8C-sleep/
Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of thescript itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. isnot included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.
<?phpset_time_limit(40);while (1) { echo "1"; }echo "test";?>Fatal error: Maximum execution time of 40 seconds exceeded inD:\www\2.php on line3
这个显示windows下 set_time_limit 也是起作用的吧。
----------------
测试下 max_execution_time 对 php网络函数的影响
a.php
<?php sleep(50); echo "test2"; ?>
b.php
<?phpset_time_limit(10); $url = "http://xxx/a.php";$ch = curl_init($url); $html = '';curl_setopt($ch, CURLOPT_TIMEOUT, 30);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$html = curl_exec($ch);curl_close($ch);echo "test1 ". $html;?>
结果浏览器显示: test1 。说明网络函数在等待数据的时间,是不计入 max_execution_time 的
----------------
a.php
<?php sleep(400); echo "test2"; ?>
不是说apache 有个timeout值是300,可是执行a.php后,浏览器还是显示了 test2。 不解。
- set_time_limit 不起作用
- php中设置set_time_limit不起作用的解决方法
- set_time_limit
- 关于php页面最大执行时间问题(set_time_limit函数在windows下不起作用的解决)
- 关于php页面最大执行时间问题(set_time_limit函数在windows下不起作用的解决)
- php中(包括织梦cms)set_time_limit(0)不起作用的解决方法
- set_time_limit函数
- php set_time_limit
- set_time_limit (int seconds) 说明
- ignore_user_abort 和set_time_limit使用
- 采集ignore_user_abort();set_time_limit
- php set_time_limit() 函数
- php set_time_limit() 函数
- PHP中set_time_limit
- php 中的set_time_limit()函数
- set_time_limit 函数定义 以及 应用
- PHP中的set_time_limit,max_execution_time,sleep
- PHP中的set_time_limit,max_execution_time,sleep
- Commits And Referring To Commits
- characteristics of data structure
- 格式化时间的函数
- 线程之synchronized 块
- UILaunchImageFile 专门解决 iphone ipad 统一版设置的default页设置项。
- set_time_limit 不起作用
- 如何在多台机器上共享IOS证书
- Gallery 模仿Flash广告栏~!附源码
- 3.8 小结与练习
- UTF-8编码中BOM的检测与删除
- 两个Fragment之间参数的传递
- python中用函数初始化类变量
- ★【贪心法】【NOI2010】航空管制
- UIAlert + UIActivityIndicator 无按钮警告框