register_shutdown_function() has no callback?

WBOY
Release: 2016-10-17 09:30:18
Original
1159 people have browsed it

<code><?php
register_shutdown_function("myerror");
function myerror(){
    error_get_last();
    echo "here";
}
function test(){}
function test(){}</code>
Copy after login
Copy after login

In this case, register_shutdown_function() is not triggered. Why? Thank you

Reply content:

<code><?php
register_shutdown_function("myerror");
function myerror(){
    error_get_last();
    echo "here";
}
function test(){}
function test(){}</code>
Copy after login
Copy after login

In this case, register_shutdown_function() is not triggered. Why? Thank you

The

register_shutdown_function function will only be called when the script exits normally or the user calls a method such as exit. Note that it exits normally. When an error occurs in the script (the above method has the same name), it will not be triggered.

Equivalent to every time you call register_shutdown_function, put the function you want to register into [pretend it’s a queue], wait until the script exits normally or displays the call exit, and then pull out the registered function If an error occurs in your script during execution, the error will be thrown directly.

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template