5種常見PHP實現URL地址跳轉代碼____PHP

來源:互聯網
上載者:User

常見PHP實現URL地址跳轉代碼

1、php跳轉代碼一句話式:

1 <?php 
2 $url = $_GET['url']; 
3 Header("Location:$url"); 
4 ?>

註:假如儲存為ad.php,即可實現ad.php?url=www.luidea.com跳轉到集思網的效果

 

2、php跳轉代碼if判斷式:

1 if($_COOKIE["u_type"]){ 
2     header('location:register.php'); 
3
4 else{ 
5    setcookie('u_type','1','86400*360');//設定cookie長期有效 
6     header('location:zc.html'); 
7 }

註:儲存為zc.php,當使用者訪問zc.php時,判斷一個cookie是否存在,如果存在就跳轉到register.php,如果不存在則建立cookie然後跳轉到zc.html

3、php跳轉代碼javascript式:

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.