我的机箱有问题,我无法从包括机箱在内的各个网站读取图像
我使用的代码是:
<?php
$doc = new DOMDocument();
$doc->load('http://www.example.com/feed/rss1.rss');
$arrFeeds = array();
$cnt=0;
foreach ($doc->getElementsByTagName('item') as $node) {
if($cnt == 5 ) {
break;
}
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
'enclosure' => $node->getElementsByTagName('enclosure')->item(0)->nodeValue
);
$cnt++;
?>
<h2><a href="<?php echo $itemRSS['link']; ?>"><?php echo $itemRSS['title']; ?></a></h2>
<p><?php echo $itemRSS['desc']; ?></p>
<img src="<?php echo $itemRSS['enclosure']; ?>">
<?php } ?>
你能告诉我哪里错了吗?谢谢 :)