php register_shutdown_function

官方描述:

void register_shutdown_function ( callback $function [, mixed $parameter [, mixed $...]] )

Registers the function named by function to be executed when script processing is complete or when exit() is called.

Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as they were registered. If you call exit() within one registered shutdown function, processing will stop completely and no other registered shutdown functions will be called.

        register_shutdown_function(do_exit());
        function do_exit()
        {
            echo "goodbye,my boys.";
        }
        exit("oh,my lady gaga!");      

这样执行exit前自动调用do_exit方法

posted @ 2011-03-17 14:47  nodot  阅读(433)  评论(0编辑  收藏  举报