PHP JSON 解析
up_user_info={"name":"liux","sex":"1","phone":"13712800254","email":"[email protected]","town":"town_1 ","年齢":"18","身長":"180","経験":"職歴"}
$up_user_info = $_POST['up_user_info'];
if($ up_user_info == null){
$error = 1;
}
$upuser_decode = json_decode($up_user_info,true);
$name = $upuser_decode['name'];
echo $name;
出力が空です~~なぜ...考えても何が問題なのか分かりません!
--- ---解決策 解決策--------------------
つまり $_POST['up_user_info'] = '{"name":"liux" ,"性別 ":"1","電話":"13712800254","メール":"[email protected]","町":"town_1","年齢":"18","身長":"180 "," experience":"職歴"}';
print_r(json_decode($_POST['up_user_info'])); 空ですか?
つまり、gbk 環境にいるということです。
print_r(json_decode(iconv('gbk', 'utf-8', $_POST['up_user_info'])));
以上です
stdClass Object<br />(<br /> [name] => liux<br /> [sex] => 1<br /> [phone] => 13712800254<br /> [email] => [email protected]<br /> [town] => town_1<br /> [age] => 18<br /> [heigh] => 180<br /> [experience] => 工作经验<br />)<br /><br />