0
我有一个json字符串,我想解析小对象的数组,我使用解码器,但它不会帮助,为什么这是幸福吗?无法解码json字符串
我已定义的变量为$ cleanforcharacters
$cleanforcharacters = preg_replace('/["{mtwrdayfsasusseto}"]_/', '', $found['newdiscounthours']);
这是我的输出
discount_org: "{"day":"8:00","time":"12:00","discount":"10","day":"8:00","time":"12:00","discount":"10"}"
这是所需的输出(对象数组)
discount_org: [
{
day: 0,
time: 8,
discount: 10
},
{
day: 0,
time: 14,
discount: 10
},
这是怎么我试过
$ arrayOfEmails = json_decode($ cleanforcharacters);
,这就是我现在越来越
discount_org: {
day: "20",
time: "12:00",
discount: "20"
}
剩下的就是不出来或者
嗯,这不是因为它是一个字符串,而不是一个对象吗?如果是这样,我不认为解码器使用字符串 – Zaz