note 51596 added to function.header
| From: | (01karlo@gmail.com) | Date: | Tue, 05 Apr 2005 13:19:45 +0000 |
| Subject: | note 51596 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87490@lists.php.net to get a copy of this message | ||
Let's face it. Sometimes, when we do many functions and many codes, and we called, header() the
message "headers already sent or function is already declared" appears. Here's a
wonderful way to do that.
<?php
function fastredirect($url){
die("<script language=\\"javascript\\" type=\\"text/javascript\\">
setTimeout(\\"window.location='$url';\\",1);
</script>");
}
function redirectmsg($url,$msg){
$msg=str_replace("'","\\'",$msg);
die("<body bgcolor=\\"white\\">
<script language=\\"javascript\\" type=\\"text/javascript\\">
document.write('<span style=\\"color: black;font-family: Verdana; font-size: 12px;
font-weight: bold;\\">$msg</span>');
setTimeout(\\"window.location='$url';\\",1);
</script></body>");
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51596
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51596&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51596&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51596&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51596&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51596&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51596&report=yes
Search -- http://master.php.net/manage/user-notes.php