note 38593 added to function.headers-sent
| From: | jonny dot keogh at btinternet dot com | Date: | Mon, 29 Dec 2003 12:13:54 +0000 |
| Subject: | note 38593 added to function.headers-sent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62627@lists.php.net to get a copy of this message | ||
You could also try this, as the full code:
<?php
// If no headers are sent, send one
if (!headers_sent()) {
header ('Location: http://www.example.com/');
exit;
}
// An example using the optional file and line parameters, as of PHP 4.3.0
// Note that $filename and $linenum are passed in for later use.
// Do not assign them values beforehand.
if (!headers_sent($filename, $linenum)) {
header ('Location: http://www.example.com/');
exit;
// You would most likely trigger an error here.
} else {
// The following will only work if they have JavaScript enabled!
print "<script language=Jscript>
window.location='http://www.example.com/';
</script>\n";
// In case the user has not got JavaScipt enabled, try VBScript.
print "<script language=VBScript>
window.location='http://www.example.com/'
</script>\n";
//And then, if all doesn't succeed, just ask the user to click the link:
print "<p>If you see this message for more than 5 seconds, <a href='http://www.example.com/'>click
here</a>.</p>";
exit;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.headers-sent.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38593
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38593&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38593&report=yes
Search -- http://master.php.net/manage/user-notes.php