This article describes the PHP function timeout processing method. Share to everyone for your reference, specific as follows:
Register_shutdown_function
Registers the function named by function to being executed when script processing are complete or when exit () is called.
This function can be registered repeatedly and then called when a fatal error or exit is encountered
error_reporting (0);
Register_shutdown_function (' Handleshutdown ');
function Handleshutdown () {
$error = Error_get_last ();
Based on the error message, determine if the timeout was exceeded
if ($error && strpos ($error [' message '], ' Maximum exec ')!== false)
{
echo ' H Andle time Out ';
}
}
Set_time_limit (2);
Sleep (3);
More interested in PHP related content readers can view the site topics: "Introduction to PHP Basic Grammar", "PHP error and Exception handling method summary" and "PHP common functions and Skills summary"
I hope this article will help you with the PHP program design.