NYCPHP Meetup

NYPHP.org

[nycphp-talk] Header() Redirect!!

Elijah Insua tmpvar at gmail.com
Fri Jun 12 00:02:02 EDT 2009


You can also use output buffering for some interesting behavior

[ http://us3.php.net/manual/en/book.outcontrol.php ]

<?php
ob_start()
?>

<html>
 ....
</html>

<?php

if ($success)
{
  header("Location: /success");
}

ob_flush_clean()
?>

I prefer to set headers at the end of the script because it is at the end of
processing
a request that you are best able to do content-type negotiation and status
based redirection.

-- Elijah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/eca2462f/attachment.html>


More information about the talk mailing list