【发布时间】:2012-02-22 19:26:28
【问题描述】:
当我将它放入 json 检查器时,它是一个有效的 json,但 php 中的 json_decode 给出了解码错误。 json部分:
"regex":{
"validator":"Regex",
"options":{
"pattern":"\/^[a-zA-Z\\.\\- ]+$\/",
"messages":"Please use letters, spaces, period and dashes only"
}
}
我查看了Regular expression messing up json_decode();,但这对我没有帮助。
谢谢!
这是整个json:
【问题讨论】:
-
json_decode得到哪个错误代码? -
json_decode() 返回空值。如果我取出那个模式,它可以很好地解码。
-
如果
json_decode失败,请参阅json_last_error以获取错误代码/消息。 -
当 I 将它放入 json 检查器时,我得到一个错误...
-
它只是整个 json 的一部分,但它是问题区域。如果你把 {} 括起来,我会从 json checker 得到有效的 json。