用法一例:
response.redirect "../test.asp"
php中也有類似函數:header
用法一例:
header("location:../test.php");
但是兩者是有區別的.
asp的redirect函數可以 " /> 日韩欧美视频一区,亚洲免费av片,久久人人88

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php的header和asp中的redirect比較

ASP中實現重定向是用response.redirect 函數:
用法一例:
response.redirect "../test.ASP"
php中也有類似函數:header
用法一例:
header("location:../test.php");
但是兩者是有區別的.
ASP的redirect函數可以在向客戶發送頭文件后起作用.

<html><head></head><body>
<%response.redirect "../test.ASP"%>
</body></html>
查是php中下例代碼會報錯:
<html><head></head><body>
<?
header("location:../test.php");
?>
</body></html>
只能這樣:
<?
header("location:../test.php");
?>
<html><head></head><body>...</body></html>
即header函數之前不能向客戶發送任何數據.

   再看下面一例:
ASP
<html><head></head><body>
<%
response.redirect "../a.ASP"
response.redirect "../b.ASP"
%>
</body></html>
結果是重定向a.ASP文件.
php呢?
<?
header("location:../a.php");
header("location:../b.php");
?>
<html><head></head><body></body></html>
我們發現它重定向b.php.
原來在ASP中執行redirect后不會再執行后面的代碼.
php在執行header后,繼續執行下面的代碼.
    在這方面上php中的header重定向不如ASP中的重定向.有時我們要重定向后,不能執行后面的代碼:
一般地我們用
if(...)
header("...");
else
{
...
}
但是我們可以簡單的用下面的方法:
if(...)
{ header("...");break;}

php技術php的header和asp中的redirect比較,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 阿合奇县| 故城县| 石台县| 许昌县| 井研县| 田阳县| 丰镇市| 灵山县| 雅安市| 武强县| SHOW| 纳雍县| 铅山县| 微山县| 阿拉善右旗| 丰宁| 自治县| 潮州市| 武清区| 颍上县| 甘洛县| 龙岩市| 明水县| 庆阳市| 高邮市| 南漳县| 吴川市| 台北县| 华池县| 德昌县| 赤城县| 维西| 马关县| 桑日县| 安陆市| 民乐县| 花垣县| 绥芬河市| 通辽市| 安化县| 台中县|