Sending mail before changing header location
From php.net:
<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://www.example.com/');
?&g开发者_JAVA百科t;
Is it ok to read cookies and use mail() before changing header location?
header()
will give errors, if something before it is printed on screen. If your cookie reading won't echo/print something out, then it should be ok. Same applies to mail()
.
Yes, it is perfectly OK to read cookie and use mail() before header location for redirecting.
精彩评论