下面列举几种PHP常见json错误格式:

//wrong
$str1 = <<<EOD
{“dealList”:”\r\n\t”}
EOD;

//right
$str2 = <<<EOD
{“dealList”:”\\r\\n\\t”}
EOD;

//wrong
$str3 = <<<EOD
{‘dealList’:'\r\n’}
EOD;

//wrong
$str4 = <<<EOD
{‘dealList’:'\\r\\n’}
EOD;

//wrong
$str5 = “{‘dealList’:'\r\n’}”;

//wrong
$str6 = “{‘dealList’:'\\r\\n’}”;

//right
$str7 = ‘{“dealList”:”\r\n”}’;

$c = json_decode($str1);

var_dump($c);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-11-17
  • 2021-10-22
  • 2021-08-10
  • 2021-10-18
猜你喜欢
  • 2022-12-23
  • 2021-05-19
  • 2021-10-04
  • 2021-12-19
  • 2022-12-23
  • 2021-04-22
  • 2021-10-09
相关资源
相似解决方案