Home  >  Article  >  Backend Development  >  Detailed explanation of the use of php set_time_limit() function_PHP tutorial

Detailed explanation of the use of php set_time_limit() function_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:09:12846browse

Syntax: void set_time_limit (int seconds)

Description:
Set the number of seconds allowed for a program to execute , if the limited time is reached, the program will return an error. Its default limit time is 30 seconds. The value of max_execution_time is defined in the structure file (called php3.ini in PHP3 and php.ini in PHP4). If the number of seconds is set to 0, it means there is no time limit. .

When this function is called, set_time_limit() will restart the calculation of the maximum execution time from zero. That is to say, if the maximum execution time is the default 30 seconds, and this function is called It has taken 25 seconds to execute the program before set_time_limit(20), so the maximum execution time of the program will be 45 seconds.

Note: When PHP is running in safe mode, set_time_limit() will have no results unless safe mode is turned off or the structure file is modified ( It is called php3.ini in PHP3 and php.ini in PHP4) time limit.

Example:
set_time_limit(1000)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327322.htmlTechArticleSyntax: void set_time_limit (int seconds) Description: Set the number of seconds a program is allowed to execute. If the limit is reached time, the program will return an error. Its preset limit time is...
Statement:
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