知识屋:更实用的电脑技术知识网站
所在位置:首页 > 编程技术 > PHP编程

PHP转换国际编码

发布时间:2015-05-27 19:32:00作者:知识屋

[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.zhishiwu.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]); 
                                    } 
                            } 
                        } 
                    } 
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜