搜尋

首頁  >  問答  >  主體

javascript - php偵測網址 跳轉頁面

先看一段js程式碼:

MacPlayer.Html = '<iframe width="100%" height="'+MacPlayer.Height+'" allowTransparency="true" frameborder="0" scrolling="no" src="http://www.qbzhan.com/chaojikan.php?url='+MacPlayer.PlayUrl+'"></iframe>';
MacPlayer.Show();

http://www.qbzhan.com/chaojik...

需求:

寫一段php程式碼偵測等於號碼後面的內容:

所指的php程式碼也就是:http://www.qbzhan.com/chaojik...

如果訪問網址是:
http://www.qbzhan.com/chaojik...

那讓php跳到:新連結:
http://www.qbzhan.com/iqi.php...
也就是:
http://www.qbzhan.com/iqi.php...

漂亮男人漂亮男人2791 天前546

全部回覆(2)我來回復

  • 怪我咯

    怪我咯2017-05-16 12:04:09

    你的url全部變成連結了,修改下吧,不然看不懂你在問啥問題

    回覆
    0
  • 高洛峰

    高洛峰2017-05-16 12:04:09

    解決了謝謝

    <?php
    $url=empty($_GET['vid'])?$_GET['url']:$_GET['vid'];
    $needleA= 'acfun.cn'; $needleB= 'iqiyi.com'; $needleC= 'v.qq.com'; $needleD= 'youku.com'; $needleE= 'toutiao.com';
         if(strpos($url, $needleA)>0){echo "<script>window.onload=function(){location.href='http://www.12399688.com/index/acfun.php?url=$url';}</script>";}
    else if(strpos($url, $needleB)>0){echo "<script>window.onload=function(){location.href='http://www.65yw.com/rooog1/iqiyi.php?id=$url';}</script>";}
    else if(strpos($url, $needleC)>0){echo "<script>window.onload=function(){location.href='http://www.12399688.com/index/qqvod.php?url=$url';}</script>";}
    else if(strpos($url, $needleD)>0){echo "<script>window.onload=function(){location.href='http://www.12399688.com/index/youku.php?url=$url';}</script>";}
    else if(strpos($url, $needleE)>0){echo "<script>window.onload=function(){location.href='http://www.12399688.com/index/https.php?url=$url';}</script>";}
    else{echo "<script>window.onload=function(){location.href='http://www.12399688.com/admin.php?url=$url';}</script>";}
    ?>

    回覆
    0
  • 取消回覆