Home  >  Article  >  Backend Development  >  Example of method to capture timeout events in PHP_PHP tutorial

Example of method to capture timeout events in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:06:551157browse

Examples of methods for capturing timeout events in PHP

This article mainly introduces examples of methods for capturing timeout events in PHP. This article directly gives sample code. Friends who need it can refer to it. Next

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

So the following method is needed:

?

1

2

3

4

5

6

7

8

9

ini_set ( 'max_execution_time', 1 );

function shutdown() {

$a = error_get_last ();

print_r ( $a );

}

register_shutdown_function ( 'shutdown' );

while ( true ) {

}

1 2

3

4 5

67 8 9
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. http://www.bkjia.com/PHPjc/957534.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/957534.htmlTechArticleExamples of methods for capturing timeout events in PHP This article mainly introduces examples of methods for capturing timeout events in PHP. This article The sample code is given directly. Friends who need it can refer to set_error_h...
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