
Originally Posted by
Proudirish.com
Thanks for that tip, I've added it to my script. What is the advantage of using exit; like that?
After the header was send, the script will not stop. PHP just sends a header... but things are still working after your redirect. Example:
PHP Code:
<?php
header('Location: http://www.google.com');
file_put_contents('file.txt', 'we have it');
so, just to be sure:
PHP Code:
<?php
header('Location: http://www.google.com');
exit; // we stop here!
file_put_contents('file.txt', 'we have it');
Bookmarks