PHP function timeout and php timeout. PHP function timeout processing method, php timeout processing method this article describes the PHP function timeout processing method. For your reference, see register_shutdown_functionR PHP function timeout and php timeout.
This article describes how to handle PHP function timeout. We will share this with you for your reference. The details are as follows:
Register_shutdown_function
Registers the function named by function to be executed when script processing is complete or when exit () is called.
This function can be registered repeatedly and then called in turn when a fatal error or exit occurs.
Error_reporting (0); register_shutdown_function ('handleshutdown'); function handleShutdown () {$ error = error_get_last (); // based on the error message, determine if the request times out if ($ error & strpos ($ error ['message'], 'maximum exec ')! = False) {echo 'handle time out';} set_time_limit (2); sleep (3 );