简体   繁体   中英

Custom error handler strange behaviour - PHP

I am having weird problems with custom error handler, here it is:

function errHandler($errno, $errstr, $errfile, $errline)
{
    if($errno)
    {
        header('HTTP/1.1 503 Service Temporarily Unavailable');
        header('Status: 503 Service Temporarily Unavailable');
        header('Retry-After: 3600');

        exit;
    }

    return true;
}

everytime when running:

set_error_handler('errHandler'); 

The header is being sent despite lack of any error? Any ideas?

尝试对var_dump() $errno, $errstr, $errfile, $errline进行查看,看是否有任何提示。

Syntax is "503 Service Unavailable"

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM