Php 是否有办法从关机功能中了解退出状态代码?

Php 是否有办法从关机功能中了解退出状态代码?,php,Php,有没有办法从关闭函数中知道传递给exit()的值 例如: <?php function handleShutdown(){ // Is there a way to know the value passed to exit() at this point? someCleanup(); } register_shutdown_function('handleShutdown'); if(somethingWentWrong()){ exit(3); }

有没有办法从关闭函数中知道传递给
exit()
的值

例如:

<?php

function handleShutdown(){
    // Is there a way to know the value passed to exit() at this point?

    someCleanup();
}

register_shutdown_function('handleShutdown');

if(somethingWentWrong()){
    exit(3);
}

exit(0);

                                          
您可以,这将为您提供

然后在
handleShutdown
功能中使用它:

$exitCode=uopz_get_exit_status();

uopz\u get\u exit\u status()的存在似乎证明了没有原生方式。不幸的是,我目前无法轻松安装uopz,但这似乎是一个很好的B计划。