close

[轉貼自]http://www.vixual.net/blog/archives/161


幾種網頁轉址的語法


HTML

<head>
<meta http-equiv=refresh content="0;url=http://host.domain.tld/path/to/">
</head>

JavaScript

<script language="JavaScript">
<!--
window.location.href = "http://host.domain.tld/path/to/";
//-->
</script>

PHP

<?php
header("Location: http://host.domain.tld/path/to/");
?>

(轉址前不可有任何資料輸出)


Perl

#!/usr/bin/perl -w
print "Location: http://host.domain.tld/path/to/ \n\n";

(轉址前不可有任何資料輸出)


Perl – 使用 CGI 模組

#!/usr/bin/perl -w
use CGI qw/:standard/;
my $CGI = CGI->new();
print $CGI->redirect("http://host.domain.tld/path/to/");

(轉址前不可有任何資料輸出)


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 chyuanyiin 的頭像
    chyuanyiin

    PCTOP 銓尹行銷顧問有限公司 CHYUANYIIN 的談天說地溫馨小窩

    chyuanyiin 發表在 痞客邦 留言(0) 人氣()