我正在使用這個simplepie,並且已將文件上傳到我的主機。除了一件事以外,一切似乎都很好。我從中獲取Feed的博客中有圖片,當我使用simplepie查看Feed時,圖片不顯示。當我用simplepie查看博客時,有沒有辦法讓圖像顯示出來?SimplePie可以從Feed中抓取圖像
好吧,我很抱歉,我是新來的。我只是直接從網站使用代碼來嘗試查看博客。我會把代碼放在這裏的底部。所以,就像我說過的,我只是試圖讓圖片展示在我正在閱讀的博客上。除此之外,一切都顯得很棒。
---頭信息---
<?php
// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('simplepie.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
// Set the feed to process.
$feed->set_feed_url('http://wordpress.homickdesign.com/feed/');
// Run SimplePie.
$feed->init();
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
// Let's begin our XHTML webpage code. The DOCTYPE is supposed to be the very first thing, so we'll keep it on the same line as the closing-PHP tag.
?>
--- ---代碼
<h2><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_description(); ?></a><br />
<span>Latest news from Robert Homick</span></h2>
<?php
$c=1;
foreach ($feed->get_items() as $item):
if($c <= 3){
?>
<p><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a><br />
<?php echo $item->get_description(); ?><br />
<span>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></span><br />
<?php $c++;?>
<?php } endforeach; ?>
除非您發佈源代碼,否則我們無法爲您提供幫助。是的,SimplePie獲取媒體元素,但某些類型可能會非常棘手。 – Brad 2012-03-09 04:47:51
好吧,我添加了代碼,對不起,我是這個新東西。 – user1258449 2012-03-09 15:31:50
你應該接受一個Muskies的回答 – Kemal 2013-07-21 10:01:59