PHP语法错误:JSON.parse:expected'';或';}';在第6行对象的属性值之后
我是一名编码初学者,我需要你的帮助。 我正在尝试使用valide json,但出现以下错误: SyntaxError:JSON.parse:JSON数据第6行第35列的对象中的属性值后面应该有“,”或“}” 我在php文件中尝试了这个正则表达式:PHP语法错误:JSON.parse:expected'';或';}';在第6行对象的属性值之后,php,json,Php,Json,我是一名编码初学者,我需要你的帮助。 我正在尝试使用valide json,但出现以下错误: SyntaxError:JSON.parse:JSON数据第6行第35列的对象中的属性值后面应该有“,”或“}” 我在php文件中尝试了这个正则表达式: preg\u match\u all(“/”]*)?[\s]*[\/]?[\s]*>/si“,$contents,$match) 我的Json告诉我(请参阅附件中的图片,查看“html”中的内容): `{ “CMS”:“tumblr”, “标题”:“L
preg\u match\u all(“/”]*)?[\s]*[\/]?[\s]*>/si“,$contents,$match)代码>
我的Json告诉我(请参阅附件中的图片,查看“html”中的内容):
`{
“CMS”:“tumblr”,
“标题”:“LE博客de贝蒂- LE博客de贝蒂:博客模式,博客倾向,照片de模式Betty Autier”,
“元标记”:{
“视口”:{
“html”:“,
“内容”:“宽度=设备宽度,最小刻度=1,最大刻度=1”
},
“说明”:{
“html”:“,
“内容”:“LE博客贝蒂:博客模式,博客倾向,照片模式Betty Autier”
},
“发电机”:{
“html”:“,
“内容”:“WPML版本:3.1.8.3 stt:4,1,2,65;0”
},
“og:locale”:{
“html”:“,
“内容”:“fr_fr”
},
“og:类型”:{
“html”:“,
“内容”:“网站”
},
“og:标题”:{
“html”:“,
“内容”:“LE博客de贝蒂- LE博客de贝蒂:博客模式,博客倾向,照片de模式Betty Autier”
},
“og:说明”:{
“html”:“,
“内容”:“LE博客贝蒂:博客模式,博客倾向,照片模式Betty Autier”
},
“og:url”:{
“html”:“,
“内容”:http://leblogdebetty.com/"
},
“og:站点名称”:{
“html”:“,
“内容”:“Le Blog de Betty”
},
“文章:出版商”:{
“html”:“,
“内容”:http://facebook.com/leblogdebetty"
}
},
“链接”:{
“快捷方式图标”:{
“html”:“,
“href”:”http://localhost:8888/images/2013/12/favicon.ico"
},
“规范的”:{
“html”:“,
“href”:”http://leblogdebetty.com/"
},
“下一步”:{
“html”:“,
“href”:”http://leblogdebetty.com/page/2/"
},
“出版商”:{
“html”:“,
“href”:”https://plus.google.com/+leblogdebetty“
},
“‘dns预取’”:{
“html”:“,
“href”:“'//s.w.org'/”
},
“样式表”:{
“html”:“,
“href”:”http://leblogdebetty.com/wp-content/plugins/jetpack/css/jetpack.css?ver=3.4.3"
},
"'https://api.w.org/' ": {
“html”:“,
“href”:”http://leblogdebetty.com/wp-json/' /"
}
}
}
`
有人能帮我解决这个问题吗?在相应字段上使用htmlentities()
函数将引号转换为它们的“
表示形式
您还可以尝试addslashes()
,它从“
转义到\”
您想做什么?从Json获取值?请查看以下内容:图像中的Json有未转义的引号,并且无效meta\nname=“viewport”“…
@kishor:我正在尝试获取一个有效的Json,但我不知道怎么做。应该接受这个答案。您可能需要遍历结果集,在每个字段上调用它。
{
"CMS": "tumblr",
"title": "Le Blog de Betty - Le Blog de Betty : Blog mode, blog tendances, photos de mode par Betty Autier",
"metaTags": {
"viewport": {
"html": "",
"content": "width=device-width,minimum-scale=1,maximum-scale=1"
},
"description": {
"html": "",
"content": "Le Blog de Betty : Blog mode, blog tendances, photos de mode par Betty Autier"
},
"generator": {
"html": "",
"content": "WPML ver:3.1.8.3 stt:4,1,2,65;0"
},
"og:locale": {
"html": "",
"content": "fr_FR"
},
"og:type": {
"html": "",
"content": "website"
},
"og:title": {
"html": "",
"content": "Le Blog de Betty - Le Blog de Betty : Blog mode, blog tendances, photos de mode par Betty Autier"
},
"og:description": {
"html": "",
"content": "Le Blog de Betty : Blog mode, blog tendances, photos de mode par Betty Autier"
},
"og:url": {
"html": "",
"content": "http://leblogdebetty.com/"
},
"og:site_name": {
"html": "",
"content": "Le Blog de Betty"
},
"article:publisher": {
"html": "",
"content": "http://facebook.com/leblogdebetty"
}
},
"links": {
"shortcut icon": {
"html": "",
"href": "http://localhost:8888/images/2013/12/favicon.ico"
},
"canonical": {
"html": "",
"href": "http://leblogdebetty.com/"
},
"next": {
"html": "",
"href": "http://leblogdebetty.com/page/2/"
},
"publisher": {
"html": "",
"href": "https://plus.google.com/+leblogdebetty"
},
"'dns-prefetch' ": {
"html": "",
"href": "'//s.w.org' /"
},
"stylesheet": {
"html": "",
"href": "http://leblogdebetty.com/wp-content/plugins/jetpack/css/jetpack.css?ver=3.4.3"
},
"'https://api.w.org/' ": {
"html": "",
"href": "'http://leblogdebetty.com/wp-json/' /"
}
}
}