如何在
PHP脚本中完成以下内容?
code{ $result1 = task1() or break; $result2 = task2() or break; } common_code(); exit();
从PHP帮助doco中,您可以指定在exit()之后但在脚本结束之前调用的函数.
请随时查看doco了解更多信息http://us3.php.net/manual/en/function.register-shutdown-function.php
<?PHP function shutdown() { // This is our shutdown function,in // here we can do any last operations // before the script is complete. echo 'Script executed with success',PHP_EOL; } register_shutdown_function('shutdown'); ?>