Heim >Backend-Entwicklung >PHP-Tutorial > PHP变换国际编码

PHP变换国际编码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:12:40880Durchsuche

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();
							}
						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('/
][^>]*>(.*?) /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]); } } } }
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn