ホームページ >バックエンド開発 >PHPチュートリアル >json が配列を変換すると中国語は NULL ソリューションになります
json が array
を変換するとき、中国語は NULL ソリューションになります
$json='[{"ZtdID":"100000","ZtdNo":"001 ","ZtdName":"店舗番号 1 ","住所":"店舗番号 01, YY Road, ZZ District, XX都市 ","備考 ":"","エリアID":"01","ZtdTel":"0000-8888888","ZtdContact":"張三"},{"ZtdID":"100001","ZtdNo" :"002 ","ZtdName":"店舗No.1","住所":"XX市ZZ地区YY道路01号店","備考":"","エリアID":"01" ,"ZtdTel":"0000-8888888" ,"ZtdContact":"李三"}]';
var_dump(json_decode($json,true));
?>
出力は NULL
よく調べてみたところ、コーディングの問題でしたので解決していただけますか。
<br /> $json='[{"ZtdID":"100000","ZtdNo":"001 ","ZtdName":"1号店 ","Address":"XX市ZZ区YY路01号铺 ","Remark":"","AreaID":"01","ZtdTel":"0000-8888888","ZtdContact":"张三"},{"ZtdID":"100001","ZtdNo":"002 ","ZtdName":"1号店 ","Address":"XX市ZZ区YY路01号铺 ","Remark":"","AreaID":"01","ZtdTel":"0000-8888888","ZtdContact":"李三"}]';<br /> debug( $json );<br /> debug( json_decode($json,true) );<br />
<br /> [{"ZtdID":"100000","ZtdNo":"001 ","ZtdName":"1号店 ","Address":"XX市ZZ区YY路01号铺 ","Remark":"","AreaID":"01","ZtdTel":"0000-8888888","ZtdContact":"张三"},{"ZtdID":"100001","ZtdNo":"002 ","ZtdName":"1号店 ","Address":"XX市ZZ区YY路01号铺 ","Remark":"","AreaID":"01","ZtdTel":"0000-8888888","ZtdContact":"李三"}]<br /> <br /> Array<br /> (<br /> [0] => Array<br /> (<br /> [ZtdID] => 100000<br /> [ZtdNo] => 001 <br /> [ZtdName] => 1号店 <br /> [Address] => XX市ZZ区YY路01号铺 <br /> [Remark] => <br /> [AreaID] => 01<br /> [ZtdTel] => 0000-8888888<br /> [ZtdContact] => 张三<br /> )<br /> <br /> [1] => Array<br /> (<br /> [ZtdID] => 100001<br /> [ZtdNo] => 002 <br /> [ZtdName] => 1号店 <br /> [Address] => XX市ZZ区YY路01号铺 <br /> [Remark] => <br /> [AreaID] => 01<br /> [ZtdTel] => 0000-8888888<br /> [ZtdContact] => 李三<br /> )<br /> <br /> )<br />