<?php $json_string = $_POST["txt_json"]; if(ini_get("magic_quotes_gpc")=="1") { $json_string=stripslashes($json_string); } $user = json_decode($json_string); echo var_dump($user); ?>
In this file, first get the value of the POST form field txt_json in the html file, put it into the variable $json_string, and then judge that if the current PHP setting is magic_quotes_gpc=On, that is, the incoming double quotes will be transferred meaning, the json_decode function cannot parse it, so we need to unescape it. Then, use the json_decode function to convert the JSON text into an object, save it in the $user variable, and finally use echo var_dump($user); to dump the object out.
More Use PHP to receive POST data and parse json For data-related articles, please pay attention to the PHP Chinese website!