Details of the use of php set_time_limit of function

  • 2020-06-03 06:09:08
  • OfStack

Grammar: void set_time_limit (int seconds)

Description: Sets the number of seconds a program is allowed to run. If the limit is reached, the program will return an error. The default limit is 30 seconds. The value of max_execution_time is defined in the structure file (called ES12en3.ini in PHP3 and php.ini in PHP4). Setting the number of seconds to 0 means there is no time limit.

When this function is called, set_time_limit() recalculates the maximum execution time from zero, that is, if the maximum execution time is the preset 30 seconds and it took 25 seconds to execute the program before calling this function set_time_limit(20), the maximum execution time will be 45 seconds.

Note: when PHP is executed in safe mode, set_time_limit() will have no result unless you turn off safe mode or modify the time limit in the structure file (called php3.ini in PHP3 and ES35en.ini in PHP4).

Example: set_time_limit (1000).

Related articles: