Reputation: 63626
When exit()
is executed,trigger another procedure,is there an easy way?
Upvotes: 8
Views: 7619
Reputation: 166046
When exit is called, you'll still trigger any registered shutdown functions. You can use that to "catch" any calls to exit.
Upvotes: 6
Reputation: 400912
exit()
terminates the execution of the script -- so, there is not much than can be done after it's been called.
Still, quoting the manual :
Shutdown functions and object destructors will always be executed even if
exit()
is called.
So, you cannot "trigger another procedure" when exit()
is called -- but you can register a function that will be called each time the PHP script ends ; including the times when it's being terminated because of a call to exit()
.
Upvotes: 9