我在 Javascript 中有一个 JSON 数据,使用 JSON.stringify 制作表单数组
{
"user":"Mark",
"id":"80",
"0":["age","=","twenty four","varchar"],
"1":["prefix","=","Mr.","enum"]
}
我通过 AJAX 将其发送到 PHP 文件。当我回显 POST 时,我得到了值
echo (serialize($_POST['data']));
s:263:
"{
"user":"Mark",
"id":"80",
"0":["age","=","twenty four","varchar"],
"1":["prefix","=","Mr.","enum"]
}";
如何在数组或对象中获取 POSTed 数据。我试过做
var_dump(json_decode($_POST['data']));
AND
var_dump(json_decode(serialize($_POST['data']))); AND var_dump(json_decode($_POST['data'],true));
但他们没有工作。输出为空。