Vixual / 122 posts / tags / 62 comments / feed / comments feed /
Search:

幾種網頁轉址的語法

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/");

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

收藏至網路書籤: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Google
  • Live
  • YahooMyWeb
  • MyShare
  • Hemidemi
  • Funp

您可能會對以下這些文章感興趣

您對這篇文章的評價:
1 Star2 Stars3 Stars4 Stars5 Stars (有 2 人給予評價)
Loading ... Loading ...

沒有任何留言

發表您的評論

(您的留言會在審核後才能公開)