PHP profiling delay before shutdown function

后端 未结 3 614
感动是毒
感动是毒 2021-01-19 05:05
// VERY BEGIN OF SCRIPT
$_SERVER[\'HX_startTime\'] = microtime(true);

...

// MY SHUTDOWN FUNCTION
register_shutdown_function(\'HX_shutdownFn\');
function HX_shutdo         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-19 05:15

    A shutdown function will run out of the normal stack after some connection would be closed and cleanup is done. A delay will always occur as its kind of nature of this function, depending what you have done before or try to do in this function.

    The manual does not tell but it is a DEBUGGING function and should also be treated so.

    On normal operation you should never use it. There is no advantage. You may call your shutdown function on end of the script manually and leave a handler for unexpected shutdowns.

提交回复
热议问题