国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php 獲得當前的腳本網(wǎng)址和相對路徑轉化成絕對路徑正則

2024-09-04 11:47:14
字體:
來源:轉載
供稿:網(wǎng)友

獲得當前的腳本網(wǎng)址和相對路徑轉化成絕對路徑正則

  1. <?  
  2.  
  3. function relative_to_absolute($content$feed_url) {   
  4. preg_match('/(http|https|ftp):///'$feed_url$protocol);   
  5. $server_url = preg_replace("/(http|https|ftp|news):///"""$feed_url);  
  6. $server_url = preg_replace("//.*/"""$server_url);   
  7.     if ($server_url == '') {   
  8.         return $content;   
  9.     }   
  10.     if (isset($protocol[0])) {   
  11. $new_content = preg_replace('/href="//''href="'.$protocol[0].$server_url.'/'$content);   
  12. $new_content = preg_replace('/src="//''src="'.$protocol[0].$server_url.'/'$new_content);   
  13.     } else {   
  14. $new_content = $content;   
  15.     }   
  16.     return $new_content;   
  17. }   
  18. ?> 

獲得當前的腳本網(wǎng)址

  1. <?  
  2. function get_php_url(){  
  3.         if(!emptyempty($_server["request_uri"])){ 
  4.  
  5. $scriptname = $_server["request_uri"];  
  6. $nowurl = $scriptname;  
  7.         }else{  
  8. $scriptname = $_server["php_self"]; //  
  9.                 if(emptyempty($_server["query_string"])) $nowurl = $scriptname;  
  10.                 else $nowurl = $scriptname."?".$_server["query_string"];  
  11.         } 
  12. // 
  13.         return $nowurl;  

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 洪雅县| 申扎县| 桃源县| 东源县| 东阳市| 土默特左旗| 敦煌市| 益阳市| 阳江市| 临夏县| 遂溪县| 茂名市| 湖口县| 那坡县| 普格县| 会东县| 临邑县| 晋中市| 伊金霍洛旗| 磐安县| 澄江县| 屏东县| 浦北县| 永安市| 莫力| 榕江县| 隆子县| 聂拉木县| 科技| 开江县| 师宗县| 晋江市| 楚雄市| 白银市| 东乡县| 江华| 江华| 盐源县| 南部县| 巴林左旗| 延寿县|