0
我得到一個div出現在調用RSS提要的輸出中。它忽略了我將它包裝在段落標記中並將數據推送到div的嘗試。
foreach ($feed->get_items(0 , 3) as $item):
$feedDescription = $item->get_content();
$image = returnImage($feedDescription);
$image = scrapeImage($image);
$image_url= $item->get_permalink();
$description = $item->get_description();
?>
<div class="item">
<h4><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h4>
<div class="image-box"><?php echo '<a href="' . $image_url . '"><img src="' . $image . '" /></a>'."\n";?></div>
<p><?php echo $description ?></p>
<p><a href="<?php echo $item->get_permalink(); ?>">Continue Reading</a></p>
</div>
<?php endforeach; ?>
下面是HTML輸出:
<div class="item">
<h4><a href="#">Lorem Ipsum</a></h4>
<div class="image-box"><a href="#"><img src="image.jpg"></a>
</div>
<p></p>
<div>Lorem Ipsum description [...]</div>
<p></p>
<p><a href="#">Continue Reading</a></p>
</div>
爲什麼說明調用添加div標籤並沒有得到包裹在段落標記?
我能夠通過jquery以編程方式刪除div。謝謝 –