PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $reg = '{"all":{"razdel":[{"name":"ИМЯ 1 РАЗДЕЛА","photo":[{"url_photo":"ССЫЛКА НА 1 ФОТО 1го раздела"},{"url_photo":"ССЫЛКА НА 2 ФОТО 1го раздела"}]},{"name":"ИМЯ 2 РАЗДЕЛА","photo":[{"url_photo":"ССЫЛКА НА 1 ФОТО 2го раздела"}]}]}}'; $Counter_Profile = 0; $gen = json_decode($reg, true); echo '<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> </title> </head> <body><ul> '; foreach ($gen["all"]["razdel"] as $arr) { echo "<li>" . $arr["name"] . "</li>". PHP_EOL; foreach ($arr["photo"] as $photo) { if (file_exists($photo["url_photo"])) { echo '<img src="' . $photo["url_photo"] . ' alt="Ссылка из раздела">' .PHP_EOL; } else { echo "Ошибка обработки фотографии. Файл не найден." . PHP_EOL; } } } echo "</ul></body></html>";
Show:  
Copy Clear