Skip to content


动态改变脚本的执行时间,解决执行超时问题

在 php 的配置/信息里面有一个设置脚本执行时间的函数,具体情况如下: set_time_limit 配置该页最久执行时间。 语法: void set_time_limit(int seconds); 返回值: 无 函数种类: PHP 系统功能 内容说明 本函数用来配置该页最久执行时间。默认值是 30 秒,在 php.ini 中的 max_execution_time 变量配置,若配置为 0 则不限定最久时间。当执行到该函数时,才开始计算。例如,若默认是 30 秒,而在执行到该函数前已执行了 25 秒,而用本函数改为 20 秒,则该页面最长执行时间为 45 秒。 使用实例:

  1. <?php
  2. set_time_limit(200);
  3. ?>

Posted in Development.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.