程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> PHP轉換國際編碼

PHP轉換國際編碼

編輯:關於PHP編程

[php] 
if(isset($_GET['order_id']) && $_GET['order_id']!==''){ 
                    $oid=$_GET['order_id']; 
                    $result=$db->Execute("select `d_no` from `delivery` where `oid`=".$oid); 
                    $delivery_no=''; 
                    if($result->RecordCount()>0){ 
                        while(!$result->EOF){ 
                            $delivery_no=$result->fields['d_no']; 
                            $result->MoveNext(); 
                            } www.2cto.com
                        if($delivery_no!==''){           
                                $html=file_get_contents('http://tracking.post.japanpost.jp/service/singleSearch.do?searchKind=S004&locale=ja&reqCodeNo1='.$delivery_no);     
                                if($html){ 
                                    preg_match_all('/<table[^>][^>]*>(.*?) <\/table>/si',$html,$tables);  
                                    unset($tables[0]); 
                                    function getUTFString($string){ 
                                        $encoding = mb_detect_encoding($string, array('ASCII','UTF-8','Shift-JIS','GB2312','GBK','BIG5')); 
                                        return iconv($encoding,'UTF-8',$string); 
                                        //return mb_convert_encoding($string, 'utf-8', $encoding); 
                                    } 
                                    echo getUTFString($tables[1][4]); 
                                    } 
                            } 
                        } 
                    } 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved