PHP function: set_time_limit function definition:
Void set_time_limit (int $ seconds)
Set the time allowed for script running, in seconds. If this setting is exceeded, the script returns a fatal error. The default value is 30 seconds, or the value defined in max_execution_time of php. ini. if this value exists.
When this function is called, set_time_limit () restarts the timeout counter from scratch. In other words, if the timeout value is 30 seconds by default, and 25 seconds are set in the script, for example, set_time_limit (20 ). The total running time of the script before the timeout is 45 seconds.
This function is invalid in security mode.
The set_time_limit () function and the configuration command max_execution_time only affect the execution time of the script. The operation of running the program at any time, such as using system (), stream operation, database query, etc., is executed in the script, not included in the specified maximum time, the script has been run. This is not true in Windows, because the measurement time is real.
The sleep () function varies depending on the operating system. the duration of running the program in linux is ignored, and the duration of running the program in windows is included.
Example 1:
Example 2:
Note: In linux, sleep does not work. in windows, a timeout message is reported without any output.
Example 3:
";}Error_reporting ($ es); // restore the function time_out_callback () {if (connection_status () = 2) {B () ;}} function B () {echo 'Hello world! ';}?>
Timeout error capture.