最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

[PHP]實(shí)用函數(shù)3

 更新時(shí)間:2007年11月08日 21:51:26   作者:  
//獲得當(dāng)前的腳本網(wǎng)址
復(fù)制代碼 代碼如下:

function get_php_url(){ 
        if(!empty($_server["REQUEST_URI"])){ 
                $scriptName = $_SERVER["REQUEST_URI"]; 
                $nowurl = $scriptName; 
        }else{ 
                $scriptName = $_SERVER["PHP_SELF"]; 
                if(empty($_SERVER["QUERY_STRING"])) $nowurl = $scriptName; 
                else $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"]; 
        } 
        return $nowurl; 


//把全角數(shù)字轉(zhuǎn)為半角數(shù)字
復(fù)制代碼 代碼如下:

function GetAlabNum($fnum){ 
        $nums = array("0","1","2","3","4","5","6","7","8","9"); 
        $fnums = "0123456789"; 
        for($i=0;$i<=9;$i++) $fnum = str_replace($nums[$i],$fnums[$i],$fnum); 
        $fnum = ereg_replace("[^0-9\.]|^0{1,}","",$fnum); 
        if($fnum=="") $fnum=0; 
        return $fnum; 


//去除HTML標(biāo)記
復(fù)制代碼 代碼如下:

function Text2Html($txt){ 
        $txt = str_replace("  "," ",$txt); 
        $txt = str_replace("<","&lt;",$txt); 
        $txt = str_replace(">","&gt;",$txt); 
        $txt = preg_replace("/[\r\n]{1,}/isU"," 
\r\n",$txt); 
        return $txt; 


//清除HTML標(biāo)記 
復(fù)制代碼 代碼如下:


function ClearHtml($str){ 
        $str = str_replace('<','&lt;',$str); 
        $str = str_replace('>','&gt;',$str); 
        return $str; 


//相對路徑轉(zhuǎn)化成絕對路徑
復(fù)制代碼 代碼如下:


function relative_to_absolute($content, $feed_url) {  
    preg_match('/(http|https|ftp):\/\//', $feed_url, $protocol);  
    $server_url = preg_replace("/(http|https|ftp|news):\/\//", "", $feed_url);  
    $server_url = preg_replace("/\/.*/", "", $server_url);  

    if ($server_url == '') {  
        return $content;  
    }  

    if (isset($protocol[0])) {  
        $new_content = preg_replace('/href="\//', 'href="'.$protocol[0].$server_url.'/', $content);  
        $new_content = preg_replace('/src="\//', 'src="'.$protocol[0].$server_url.'/', $new_content);  
    } else {  
        $new_content = $content;  
    }  
    return $new_content;  
}  

//取得所有鏈接
復(fù)制代碼 代碼如下:

function get_all_url($code){  
        preg_match_all('/<a\s+href=["|\']?([^>"\' ]+)["|\']?\s*[^>]*>([^>]+)<\/a>/i',$code,$arr);  
        return array('name'=>$arr[2],'url'=>$arr[1]);  


//HTML表格的每行轉(zhuǎn)為CSV格式數(shù)組 
復(fù)制代碼 代碼如下:

function get_tr_array($table) { 
        $table = preg_replace("'<td[^>]*?>'si",'"',$table); 
        $table = str_replace("</td>",'",',$table); 
        $table = str_replace("</tr>","{tr}",$table); 
function get_tr_array($table) { 
        $table = preg_replace("'<td[^>]*?>'si",'"',$table); 
        $table = str_replace("</td>",'",',$table); 
        $table = str_replace("</tr>","{tr}",$table); 
        //去掉 HTML 標(biāo)記  
        $table = preg_replace("'<[\/\!]*?[^<>]*?>'si","",$table); 
        //去掉空白字符  
        $table = preg_replace("'([\r\n])[\s]+'","",$table);
        $table = str_replace(" ","",$table);
        $table = str_replace(" ","",$table);

        $table = explode(",{tr}",$table);
        array_pop($table);
        return $table;
}

//將HTML表格的每行每列轉(zhuǎn)為數(shù)組,采集表格數(shù)據(jù)
復(fù)制代碼 代碼如下:

function get_td_array($table) { 
        $table = preg_replace("'<table[^>]*?>'si","",$table); 
        $table = preg_replace("'<tr[^>]*?>'si","",$table); 
        $table = preg_replace("'<td[^>]*?>'si","",$table); 
        $table = str_replace("</tr>","{tr}",$table); 
        $table = str_replace("</td>","{td}",$table); 
        //去掉 HTML 標(biāo)記  
        $table = preg_replace("'<[\/\!]*?[^<>]*?>'si","",$table); 
        //去掉空白字符   
        $table = preg_replace("'([\r\n])[\s]+'","",$table); 
        $table = str_replace(" ","",$table); 
        $table = str_replace(" ","",$table); 

        $table = explode('{tr}', $table); 
        array_pop($table); 
        foreach ($table as $key=>$tr) { 
                $td = explode('{td}', $tr); 
                array_pop($td); 
            $td_array[] = $td; 
        } 
        return $td_array; 


//返回字符串中的所有單詞 $distinct=true 去除重復(fù)
復(fù)制代碼 代碼如下:

function split_en_str($str,$distinct=true) { 
        preg_match_all('/([a-zA-Z]+)/',$str,$match); 
        if ($distinct == true) { 
                $match[1] = array_unique($match[1]); 
        } 
        sort($match[1]); 
        return $match[1]; 
}

相關(guān)文章

  • thinkPHP框架RBAC實(shí)現(xiàn)原理分析

    thinkPHP框架RBAC實(shí)現(xiàn)原理分析

    這篇文章主要介紹了thinkPHP框架RBAC實(shí)現(xiàn)原理,結(jié)合實(shí)例形式分析了thinkPHP框架中RBAC角色權(quán)限控制相關(guān)實(shí)現(xiàn)原理與操作技巧,需要的朋友可以參考下
    2019-02-02
  • 通過PHP的Wrapper無縫遷移原有項(xiàng)目到新服務(wù)的實(shí)現(xiàn)方法

    通過PHP的Wrapper無縫遷移原有項(xiàng)目到新服務(wù)的實(shí)現(xiàn)方法

    這篇文章主要介紹了通過PHP的Wrapper無縫遷移原有項(xiàng)目到新服務(wù)的實(shí)現(xiàn)方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-04-04
  • PHP接入微信H5支付的方法示例

    PHP接入微信H5支付的方法示例

    這篇文章主要介紹了PHP接入微信H5支付的方法示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-10-10
  • laravel 解決ajax異步提交數(shù)據(jù),并還回填充表格的問題

    laravel 解決ajax異步提交數(shù)據(jù),并還回填充表格的問題

    今天小編就為大家分享一篇laravel 解決ajax異步提交數(shù)據(jù),并還回填充表格的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-10-10
  • Yii框架連接mongodb數(shù)據(jù)庫的代碼

    Yii框架連接mongodb數(shù)據(jù)庫的代碼

    這篇文章主要介紹了Yii框架連接mongodb數(shù)據(jù)庫的代碼的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-07-07
  • 淺談PHP中關(guān)于foreach使用引用變量的坑

    淺談PHP中關(guān)于foreach使用引用變量的坑

    下面小編就為大家?guī)硪黄狿HP不使用遞歸的無限級(jí)分類的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-11-11
  • Thinkphp 框架擴(kuò)展之驅(qū)動(dòng)擴(kuò)展實(shí)例分析

    Thinkphp 框架擴(kuò)展之驅(qū)動(dòng)擴(kuò)展實(shí)例分析

    這篇文章主要介紹了Thinkphp 框架擴(kuò)展之驅(qū)動(dòng)擴(kuò)展,結(jié)合實(shí)例形式分析了Thinkphp 框架驅(qū)動(dòng)擴(kuò)展相關(guān)原理、實(shí)現(xiàn)方法及操作注意事項(xiàng),需要的朋友可以參考下
    2020-04-04
  • PHP 實(shí)例化類的一點(diǎn)摘記

    PHP 實(shí)例化類的一點(diǎn)摘記

    最近在編寫 Grace PHP5 Framework 中,我得到很多類的實(shí)例化的心得。Grace PHP5 Framework 是一個(gè)完全基于 MVC 架構(gòu)的框架,具有良好的擴(kuò)展性。它對于類的調(diào)用可以說非常的靈活。
    2008-03-03
  • PHP+ajaxfileupload+jcrop插件完美實(shí)現(xiàn)頭像上傳剪裁

    PHP+ajaxfileupload+jcrop插件完美實(shí)現(xiàn)頭像上傳剪裁

    在做項(xiàng)目的時(shí)候,經(jīng)常需要一些會(huì)員系統(tǒng)相關(guān)的內(nèi)容,比如頭像的上傳與裁剪等等,下面將這塊內(nèi)容分享給大家
    2014-06-06
  • 基于php判斷客戶端類型

    基于php判斷客戶端類型

    本文主要介紹的是PHP判斷客戶端是PC端還是移動(dòng)手機(jī)端方法,可以方便網(wǎng)站用于統(tǒng)計(jì),需要了解的朋友可以參考一下。
    2016-10-10

最新評(píng)論

大荔县| 右玉县| 榆树市| 株洲县| 琼海市| 宿迁市| 斗六市| 黄陵县| 微山县| 宜君县| 皋兰县| 长汀县| 酉阳| 康乐县| 广昌县| 布尔津县| 玉田县| 松江区| 山东省| 尼勒克县| 闵行区| 扶沟县| 平陆县| 建阳市| 新平| 芜湖市| 永平县| 龙里县| 通州区| 东乌珠穆沁旗| 衡阳市| 天等县| 兴业县| 镇平县| 邻水| 资中县| 波密县| 聂荣县| 八宿县| 汝州市| 丰台区|