Tuesday, 1 October 2013

Post-Redirect-Get pattern, exit() function porpuse

Post-Redirect-Get pattern, exit() function porpuse

I am trying to understand the pattern Post-Redirect-Get and in several
examples the people put a exit() after the redirect, like so:
if ($_POST) {
// Execute code (such as database updates) here.
// Redirect to this page.
header("Location: " . $_SERVER['REQUEST_URI']);
exit();
}
My question is about the exit() function. What is the porpuse of it? For
me, it is never readed because the page is redirect before "php
interpreter" arrive there.

No comments:

Post a Comment