嘗試將其他信息回聲通話,以確保這些線路實際上被調用,並正在顯示在預期莊園輸出 -
<title><? echo "Title: ".$item->get_title(); ?></title>
<link><? echo "Permalink: ".$item->get_permalink(); ?></link>
<pubDate><? echo "PubDate: ".$item->get_date(); ?></pubDate>
<description><? echo "Description: ".$item->get_description(); ?></description>
這種「調試輸出」可以幫助調試各種各樣的東西。它應該可以幫助你找出問題的起源。
另外,我注意到,你有大量的不必要的PHP開始和結束標記,其中多條線路可以合併成一個單一的,更乾淨的代碼塊(例:)
<?php if ($success): ?>
<? $itemlimit=0; ?>
<?php foreach($feed->get_items() as $item): ?>
<? if ($itemlimit==10) { break; } ?>
可以清理是:
<?php
if($success)
{
$itemlimit = 0;
$items = $feed->get_items(); // This might also help, as PHP sometimes has issues when iterating through arrays returned directly from functions
foreach($items as $item)
{
if($itemlimit == 0) break;
...
實際上,大部分文件可能在一對PHP標籤中。 只是一個建議。