# The result of json data decode in the php background is empty # I use a mobile phone to transmit data to the php background, and the result of json_decode is empty. The mobile phone transmission method is POSTGET, encoding format is UTF-8. Json data is (including single quotation marks in the code, which are transmitted using strings. json data must be double quotation marks): & quot; & #39 ;{& quot; agent & quot ;: & quot; 30 & quot;, & quot; job & quot;: & quot; 1133 & quot;, & quot; students & quot;: [{& quot; working_hours_un phpapijson: communication between the mobile phone server and the client
# Php background json data decode is empty #
I use my mobile phone to transmit data to the php background. the result of json_decode is blank.
The mobile phone transmission method is POST/GET, the encoding format is UTF-8.
Json data is (including single quotation marks in the code, which are transmitted using strings. json data must be double quotation marks ):
'{"agent":"30","job":"1133","students":[{"working_hours_unit":"null","working_hours":"6","student_id":"191","commission_unit":"null","wage":"58","commission":"348","wage_unit":"null"}]}'
The php code obtains the preceding json data and can use echo to output the data. Php code:
$str=$_GET('my_str'); echo $str;
Output the test result and then decode the received json data. Code:
$form = json_decode($Noel,true); var_dump($form);
Unexpectedly, the output is ** null **. then, I use _ echo json_last_error (); _ to output a json conversion error with the result of 4 = json syntax error.
Complete Code and:
$str=$_GET('my_str'); echo $str;$form = json_decode($str,true); var_dump($form); echo json_last_error();
However, when I separate the received json into the PHP code, the decode can be correctly parsed. (In my heart, the crash _ crash)
Code :'
$orm='{"agent":"30","job":"1133","students":[{"working_hours_unit":"null","working_hours":"6","student_id":"191","commission_unit":"null","wage":"58","commission":"348","wage_unit":"null"}]}'; $arr=json_decode($form,true); var_dump($arr);
: