[英]Php's json_decode and firefox's javascript compatibility
it appears if you have something like 如果您有类似的东西出现
var my_var = {"foo" : "bar"};
in javascript (with firefox at least) and post it to a php server you will receive a string like 在javascript中(至少使用Firefox)并将其发布到php服务器中,您将收到类似
{foo:"bar",}
on the server side. 在服务器端。 But json_decode in php doesn't like the trailing ',' or the lack or quotes around 'foo'.
但是php中的json_decode不喜欢结尾的','或'foo'周围的缺少或引号。 Is there a nice way to clean up the received json string?
有没有清除接收到的json字符串的好方法?
The json object is sent with the drupal module json services. json对象与drupal模块json服务一起发送。
EDIT: This question can be closed. 编辑:这个问题可以关闭。 The badly formed json is due to badly written js in the drupal module
格式错误的json是由于在drupal模块中编写的js错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.