var xx = 'dfdf';var yy = 'kfdl';var zz = 'ijklk';instance:[{"instance_name":xx,"machine_belong":yy,"access_port":zz},{"instance_name":xx,"machine_belong":yy,"access_port":zz}]
How PHP is handled in the background
instance = [{"instance_name": 1, "Machine_belong": 2, "Access_port": 3},{"instance_name": 1, "Machine_belong": 2, "access _port ": 3}];
Use this to do the test, is the JSON write the wrong, My code JSON is stitching, splicing error
Reply content:
var xx = 'dfdf';var yy = 'kfdl';var zz = 'ijklk';instance:[{"instance_name":xx,"machine_belong":yy,"access_port":zz},{"instance_name":xx,"machine_belong":yy,"access_port":zz}]
How PHP is handled in the background
instance = [{"instance_name": 1, "Machine_belong": 2, "Access_port": 3},{"instance_name": 1, "Machine_belong": 2, "access _port ": 3}];
Use this to do the test, is the JSON write the wrong, My code JSON is stitching, splicing error
instance = [{"instance_name":xx,"machine_belong":yy,"access_port":zz},{"instance_name":xx,"machine_belong":yy,"access_port":zz}]// 对instance json序列化, 才可以进行数据传输instance = JSON.stringify(instance);
PHP parsing:
$instance = json_decode($_REQUEST['instance'], true);
Buxie
You should turn the object into a string character before sending it back to the background.
See your code, is JS sent to the PHP interface?
If so, use post,php to use $res=$_post[' data '
If your calling interface is based on, Ajax ({data:{...}});
Next, PHP gets the object, similar to the Res.name
Https://github.com/yiisoft/yi ...
Please refer to this code
http://json.cn/Test JSON format