2 回答

TA貢獻(xiàn)1963條經(jīng)驗 獲得超6個贊
您可以通過這樣的 foreach 一起掃描兩個數(shù)組
if(!empty($highlights)) {
foreach(array_map(null, $highlights['highlights_title'], $highlights['highlights_description'])
as list($title, $desc)) {
echo $title.'\t'.$desc."<\br>\n";
}
}

TA貢獻(xiàn)1845條經(jīng)驗 獲得超8個贊
您有第二個 json_encode 內(nèi)容,因此:
$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 關(guān)注
- 153 瀏覽
添加回答
舉報