ASP,HTML,PHP转向代码

2010.04.19 No Comments

HTML的:

<meta http-equiv="refresh" content="3; url=target.html">
在HTML的与之间加入下面这段代码,则在3秒钟之后正在浏览的页面将会自动变为target.html这一页。代码中3为刷新的延迟时间,以秒为单位。targer.html为你想转向的目标页,若为本页则为自动刷新本页。

javascript/dhtml

用meta标签完成

<meta http-equiv="refresh" content="1;url=http://shangpan.com">
ASP的:

<%
if Request.ServerVariables("SERVER_NAME")=www.shangpan.com then
response.redirect "default.asp"
else
response.redirect "default_en.asp"
end if
%>
此ASP代码功能是当两个域名指向同一个主机时,可以自动重定向到相应的域名网站

或者:
用redirect方法

转向到 http://你的站点/news
<%
response.redirect http://shangpan.com
%>
PHP的:

PHP一般是用 header函数

重定向到 http://shangpan.com
<?php
header("Location:http://shangpan.com");
?>
或者:
<? header("location:note.php"); ?>

Related Posts:
Leave a Reply
icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif