in this article, PHP receives the data from post, and parses an example of JSON, for everyone to learn the reference. PHP receives the post data, parses the JSON code, uses PHP functions--stripslashes, Json_decode, Var_dump: Code Description: First, get the value of the Post form field Txt_json in the HTML file, put in the variable $json_string, and then judge if the current PHP is set to Magic_quotes_gpc=on, That is, the incoming double quotes are escaped so that the Json_decode function cannot be parsed, so it needs to be reversed. After inversion, use the Json_decode function to convert the JSON text to an object, save it in the $user variable, and finally use the Echo var_dump ($user), to output the object dump. , PHP JSON data parsing code PHP parsing JSON data code, it is always able to know how to parse the API data of various delivery formats, including Json,xml and so on. The following code resolves the data that everyone connected to the site post obtains: |