To implement redirection in asp, the response.redirect function is used:
An example of usage:
response.redirect "../test.asp"
There is a similar function in php: header
An example of usage:
header("location:../test.php");
But there is a difference between the two.
ASP’s redirect function can work after sending the header file to the customer.
Such as
<%response.redirect "../test.asp"%>
Check if the following example code in php will report an error:
header("location:.. /test.php");
?>
You can only do this:
header("location:../ test.php");
?>
...
i.e. header No data can be sent to the client before the function.
Look at the following example:
asp in
< %
response.redirect "../a.asp"
response.redirect "../b.asp"
%>
The result is to redirect the a.asp file. What about
php?
header("location:../a.php");
header("location:../ b.php");
?>
We found it redirected b.php.
It turns out that after executing redirect in asp, the following code will not be executed.
After executing the header, php will continue to execute the following code.
In this regard, the header in php is important. Orientation is not as good as redirection in asp. Sometimes we cannot execute the following code after redirection:
Generally we use
if(...)
header("...");
else
{
...
}
But we can simply use the following method:
if(...)
{ header("..." );break;}
http://www.bkjia.com/PHPjc/315442.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315442.htmlTechArticleThe response.redirect function is used to implement redirection in asp: Usage example: response.redirect ../test.asp There are similar functions in php: header usage example: header(location:../test.php); But both...