国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

php的header和asp中的redirect比較

瀏覽:4日期:2024-02-28 13:29:55
asp中實現(xiàn)重定向是用response.redirect 函數(shù): 用法一例: response.redirect "../test.asp" php中也有類似函數(shù):header 用法一例: header("location:../test.php"); 但是兩者是有區(qū)別的. asp的redirect函數(shù)可以在向客戶發(fā)送頭文件后起作用. 如 <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函數(shù)之前不能向客戶發(fā)送任何數(shù)據(jù). ;;;再看下面一例: asp中 <html><head></head><body> <% response.redirect "../a.asp" response.redirect "../b.asp" %> </body></html> 結(jié)果是重定向a.asp文件. php呢? <? header("location:../a.php"); header("location:../b.php"); ?> <html><head></head><body></body></html> 我們發(fā)現(xiàn)它重定向b.php. 原來在asp中執(zhí)行redirect后不會再執(zhí)行后面的代碼. 而php在執(zhí)行header后,繼續(xù)執(zhí)行下面的代碼. ;;;;在這方面上php中的header重定向不如asp中的重定向.有時我們要重定向后,不能執(zhí)行后面的代碼: 一般地我們用 if(...) header("..."); else { ... } 但是我們可以簡單的用下面的方法: if(...) { header("...");break;}
標簽: PHP
主站蜘蛛池模板: 锡林浩特市| 绩溪县| 上虞市| 白山市| 株洲县| 巨鹿县| 曲周县| 靖远县| 东乌| 贵德县| 阿鲁科尔沁旗| 色达县| 龙陵县| 社会| 宁蒗| 岑巩县| 尚义县| 陇南市| 壤塘县| 黔东| 融水| 长宁县| 清水河县| 巢湖市| 平武县| 江源县| 石城县| 白朗县| 株洲市| 孟津县| 汉源县| 淄博市| 陆河县| 平阳县| 德兴市| 饶河县| 库尔勒市| 博湖县| 夏邑县| 桐乡市| 山东省|