我有透過JSON.stringifyAJAX JSON數據不打印在PHP
{
"user":"Mark",
"id":"80",
"0":["age","=","twenty four","varchar"],
"1":["prefix","=","Mr.","enum"]
}
我正在通過AJAX發送這PHP文件在JavaScript中JSON數據所做的形式排列。當我回顯POST我得到的值
echo (serialize($_POST['data']));
s:263:
"{
"user":"Mark",
"id":"80",
"0":["age","=","twenty four","varchar"],
"1":["prefix","=","Mr.","enum"]
}";
我怎樣才能獲取數組或對象中的張貼數據。我試圖做
var_dump(json_decode($ _ POST ['data']));
AND
var_dump(json_decode(serialize($ _ POST ['data']))); var_dump(json_decode($ _ POST ['data'],true));
但他們沒有工作。輸出爲空。
'var_dump($ _ POST)'first。 – xdazz
你確定這是你的所有輸入嗎? [似乎工作正常](http://codepad.viper-7.com/PFeM7p)對我來說。 – complex857
打印$ _POST ['data']給我> {「user」:「Mark」,「id」:「80」,「0」:[「age」,「!=」,「twenty four」,「varchar 「],」1「:[」prefix「,」=「,」Mr。「,」enum「]} – HardCode