The equivalent in PHP for response.redirect in asp is what ?? Can anyone please ??
PHP and ASP?www.microsoft.com
%26lt;? header("Location: http://www.someurl.com"); ?%26gt;
Your header() calls must occur BEFORE you send any content to the browser. For example, this works:
%26lt;?
if($a == 1) {
header("Location: http://www.someurl.com");
}
echo "Hello world!";
?%26gt;
This does NOT work and will throw an error indicating that headers have already been sent:
%26lt;?
echo "Hello world!";
if($a == 1) {
header("Location: http://www.someurl.com");
}
?%26gt;
Any time you see the error message that headers have already been sent, you need to move your header() statement higher up on your page.
PHP and ASP?microsoft windows xp internet explorer
The equivalent in ASP is Response.Redirect
Same thing response.redirect("page.htm")
You can check if the headers have been set, if it has then send javascript to redirect.
if (!headers_sent()) {
header('Location: http://www.example.com/');
exit;
}else{ echo "%26lt;script%26gt;window.location.href=\"http://w...
}
No comments:
Post a Comment