尝试将其他信息回声通话,以确保这些线路实际上被调用,并正在显示在预期庄园输出 -
<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标签中。 只是一个建议。