Created
November 5, 2015 13:24
-
-
Save AJLoveChina/bc5f01cf55c862da8300 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 这几天用PHP读取一个35w行的单词本, 遇到了下面这个错误 | |
// Maximum execution time of 30 seconds exceeded | |
// 原因是程序执行的时间超过了默认的最大执行时间 30 秒 | |
// 解决方法有俩种 : | |
// 1. 修改php.ini 中max_execution_time 的值(单位 : 秒), 如果为0表示不限制执行时间 | |
// 2. 我喜欢用一个函数 void set_time_limit ( int $seconds ), 参数为0表示不限制执行时间 | |
/* | |
* 第二种方法有个有意思的地方(来自文档) | |
* 当此函数被调用时,set_time_limit()会从零开始重新启动超时计数器。换句话说,如果超时默认是30秒, | |
* 在脚本运行了了25秒时调用 set_time_limit(20),那么,脚本在超时之前可运行总时间为45秒。 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment