我需要在php上向关机函数发送两个参数。关机功能是
function shutdown($newfile,$back_file)
{
if(file_exists("../Content/8/$newfile")){
unlink("../Content/8/$newfile");
}
if(file_exists("../Content/8/$back_file")){
unlink("../Content/8/$back_file");
}
echo "Script executed with success $back_file", PHP_EOL;
}
据我所知,我可以声明并注册以下函数:
register_shutdown_function('shutdown');
有没有办法可以将这两个参数发送给函数?
谢谢!
答案 0 :(得分:2)
是的,您应该在register_shutdown_function中添加两个参数,如下所示:
register_shutdown_function('shutdown', $newFile, $previousFile);