php 更新数据库中断的解决方法_php技巧

WBOY
Release: 2016-05-17 09:32:14
Original
1009 people have browsed it

即可解决:
set_time_limit(900);
这个函数指定了当前所在php脚本的最大执行时间,
虽然设定值是900秒,实际上
最大执行时间=php.ini里的max_execution_time数值 - 当前脚本已经执行的时间 + 设定值
假如php.ini里的max_execution_time=30,当前脚本已经执行10秒,则:
最大执行时间=30-10+900=920秒。
经过如此修改后,PHP脚本成功更新200000条记录。

以上是在LAPP环境中通过的。
另外,据说这个方法在windows环境无效,在windows环境需要指定php.ini里的max_execution_time数值。
没有测试这种情况。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!