2 回答

TA贡献1963条经验 获得超6个赞
您可以通过这样的 foreach 一起扫描两个数组
if(!empty($highlights)) {
foreach(array_map(null, $highlights['highlights_title'], $highlights['highlights_description'])
as list($title, $desc)) {
echo $title.'\t'.$desc."<\br>\n";
}
}

TA贡献1845条经验 获得超8个赞
您有第二个 json_encode 内容,因此:
$data = '{"title":"Property Highlights","description":"Extensive upgrades and thorough maintenance have kept this home in prime condition. Hardwood floors and new carpets create a very comfortable living space.","content":"{\"highlights_title\":[\"Quiet Neighbourhood\",\"Fabulous views\",\"Great local community\",\"Large play center in yard\"],\"highlights_description\":[\"Enjoy tranquil and relaxed atmosphere of the place\",\"Get yourself surrounded by the stunning view opening\",\"You will be delighted by the fantastic local community\",\"Your kids will be happy having all these things around\"]}","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}';
$highlights = json_decode($data, true);
var_dump($highlights);
if (!empty($highlights)) {
$content = json_decode($highlights["content"], true);
foreach($content as $subcontent){
foreach($subcontent as $value){
echo $value . "<br/>";
}
}
}
- 2 回答
- 0 关注
- 140 浏览
添加回答
举报