Home  >  Article  >  Backend Development  >  Example of method to capture timeout event in PHP, php capture timeout example_PHP tutorial

Example of method to capture timeout event in PHP, php capture timeout example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:07:021320browse

Examples of methods to capture timeout events in PHP, PHP capture timeout examples

set_error_handler() cannot catch fatal errors (see the manual for specific error types).

So the following method is needed:

<&#63;php
ini_set ( 'max_execution_time', 1 );
function shutdown() {
 $a = error_get_last ();
 print_r ( $a );
}
register_shutdown_function ( 'shutdown' );
while ( true ) {
}

Note: sleep() pause time is not included in max_execution_time.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/957121.htmlTechArticleMethod instance for capturing timeout event in PHP, php capture timeout instance set_error_handler() cannot capture fatal error (specific error type See manual). So the following method is needed: phpini_set (...
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