Rss 使用Simplepie获取不推荐的错误
我已经安装了最新的Simplepie代码(1.2.1),并且正在使用它们提供的演示代码:Rss 使用Simplepie获取不推荐的错误,rss,simplepie,Rss,Simplepie,我已经安装了最新的Simplepie代码(1.2.1),并且正在使用它们提供的演示代码: <?php require 'simplepie.inc'; $url = 'http://news.google.com/news?ned=us&topic=h&output=rss'; $feed = new SimplePie(); $feed->set_feed_url($url); $feed->init(); // default starting it
<?php
require 'simplepie.inc';
$url = 'http://news.google.com/news?ned=us&topic=h&output=rss';
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->init();
// default starting item
$start = 0;
// default number of items to display. 0 = all
$length = 0;
// if single item, set start to item number and length to 1
if(isset($_GET['item']))
{
$start = $_GET['item'];
$length = 1;
}
// set item link to script uri
$link = $_SERVER['REQUEST_URI'];
// loop through items
foreach($feed->get_items($start,$length) as $key=>$item)
{
// set query string to item number
$queryString = '?item=' . $key;
// if we're displaying a single item, set item link to itself and set query string to nothing
if(isset($_GET['item']))
{
$link = $item->get_link();
$queryString = '';
}
// display item title and date
echo '<a href="' . $link . $queryString . '">' . $item->get_title() . '</a>';
echo ' <small>'.$item->get_date().'</small><br>';
// if single item, display content
if(isset($_GET['item']))
{
echo ' <small>'.$item->get_content().'</small><br>';
}
echo '<br>';
}
?>
有人知道怎么了吗
我运行了他们的兼容性测试,它显示所有东西都通过了。这是SimplePie的PHP4兼容性的结果,在您的代码中没有任何内容。如果要停止查看这些错误,请从
错误报告中排除E\u DEPRECATED
:
error_reporting(E_ALL & ~E_DEPRECATED);
如果您想自行修复错误,可以从中获取SimplePie 1.3-dev的副本(它会降低PHP 4的兼容性),但请记住,这是一个开发版本,而且不稳定。我在1.2.1版中发现的唯一错误报告是这样一行:
if ((ini_get('error_reporting') & $level) > 0)
这是在simplepie公司
我仍然不知道如何禁用所有这些警告,除非使用我不喜欢的开发版本,因为我有足够的代码可以按原样调试。您需要在代码中找到“=&new”的每个实例,并删除现在已弃用的“&”。代码中大约有116次出现。它与对象实例化的副本和引用有关。正确答案是可能的副本。另见。Simplepie可能在此期间进行了调整,但也就是说,与WP 3.4.2相比,修订版仍然不一致。。。因此,仍然必须将不推荐使用的警告静音。WordPress 3.5将包括SimplePie 1.3.1,它修复了所有这些问题(因为它放弃了对PHP4的支持)。
if ((ini_get('error_reporting') & $level) > 0)