网址跳转最常用的代码实现方法
网址跳转最常用的代码实现方法:
HTML版本
(1) <script language='javascript'>document.location='http://xxx' </script> 放在<head> </head>部分即可
(2)<meta http-equiv="refresh" content="1;url=http://xxx"> 放在<head> </head>部分即可
以上代码添加到网站的静态首页文件里面。
PHP版本
$duankou=$_SERVER["SERVER_PORT"];
$dqurl=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($duankou=="80"){header("location:https://".$dqurl);}
以上代码添加到index.php页面即可
HTML版本
(1) <script language='javascript'>document.location='http://xxx' </script> 放在<head> </head>部分即可
(2)<meta http-equiv="refresh" content="1;url=http://xxx"> 放在<head> </head>部分即可
以上代码添加到网站的静态首页文件里面。
PHP版本
$duankou=$_SERVER["SERVER_PORT"];
$dqurl=$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($duankou=="80"){header("location:https://".$dqurl);}
以上代码添加到index.php页面即可