Wordpress新手。
$article_data = get_field('article_item');
foreach ($article_data as $key => $item) {
$footerImg = (!empty($item['bottom_image'])) ? $item['bottom_image'] : NULL;
$url = implode( ', ', $footerImg );
echo $url;
}
输出这个:
2345,
67899,
boston_skyline,
boston_skyline.jpg,
http://localhost:8000/bostontheme/images/2018/08/boston_skyline.jpg,
2018-08-07 01:24:21
如何获取图像字符串,这样我就可以做这样的事情:
<img src="<?php echo $url ?>" />
当我做这个
print_r($item);
我得到这个输出:
Array (
[bottom_image] => Array (
[ID] => 67899
[id] => 67899
[title] => boston_skyline
[filename] => boston_skyline.jpg
[url] => http://localhost:8000/bostontheme/images/2018/08/boston_skyline.jpg
您只需要$item["bottom_image"]["url"]