我有一个要解析为小对象数组的 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"
}
其余的也没有出来