The et_time_limit function can temporarily define the execution time of your current page. when set_time_limit (0) is used, the page will always be valid until the execution of the program is completed. next I will introduce the set_time_limit syntax: voidset_time_limit) note: When PHP is executed in the security mode
The set_time_limit function can temporarily define the execution time of your current page. when set_time_limit (0) is used, the page will always be valid until the execution of the program is completed. next I will introduce the set_time_limit usage.
Syntax: void set_time_limit (int seconds)
Note: When PHP is executed in safe mode, set_time_limit () will not produce any results, unless it is disabled in safe mode or modified in the structure file (in PHP3, it is called php3.ini, PHP4 is called php. ini.
The instance code is as follows:
-
- Set_time_limit (1000)
- ?>
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 set_time_limit (20) is called when the script runs for 25 seconds, the total running time of the script before the timeout value is 45 seconds.
The instance code is as follows:
-
- Require_once ('Db. php ');
- $ Stmt = $ db-> query ($ SQL );
- While ($ row = $ stmt-> fetchRow ()){
- Set_time_limit (0 );
- // Your code here
- }
- ?>