Application of JSON string in the project:
①PHP server sends JSON response data to client JS:
PHP:
$arr=[...];
echo json_encode($arr);
JS:
var obj= JSON.parse(str);
②Client JS sends PHP server JSON response data:
JS:
var arr=[...];
var str=JSON.stringify(arr);
PHP:
$arr =json.decode($_REQUEST['str']);
③{} in JSON is parsed as Object by PHP, and the -> symbol is used to read the object members;