尝试使用wp_rss时出现大量错误

时间:2016-04-21 13:08:36

标签: php wordpress rss

我正在尝试将RSS添加到我的网站,当我使用这样的wp_rss方法时:

  <?php
require ABSPATH . WPINC . '/rss.php';
wp_rss ( 'http://miletich2.blogspot.com/feeds/posts/default?alt=rss', 5 )
?>

我收到如下大量错误:

Fatal error: Uncaught Error: Call to undefined function split() in /home/vagrant/Code/creativeforces/wp-includes/rss.php:117 Stack trace: #0 [internal function]: MagpieRSS->feed_start_element(Resource id #6, 'gd:image', Array) #1 /home/vagrant/Code/creativeforces/wp-includes/rss.php(84): xml_parse(Resource id #6, '<?xml version='...') #2 /home/vagrant/Code/creativeforces/wp-includes/rss.php(596): MagpieRSS->__construct('<?xml version='...') #3 /home/vagrant/Code/creativeforces/wp-includes/rss.php(495): _response_to_rss(Object(stdClass)) #4 /home/vagrant/Code/creativeforces/wp-includes/rss.php(901): fetch_rss('http://miletich...') #5 /home/vagrant/Code/creativeforces/wp-content/themes/creativeforces/page-media.php(30): wp_rss('http://miletich...', 5) #6 /home/vagrant/Code/creativeforces/wp-includes/template-loader.php(75): include('/home/vagrant/C...') #7 /home/vagrant/Code/creativeforces/wp-blog-header.php(19): require_once('/home/vagrant/C...') #8 /home/vagrant/Code/creativeforces/index.php(17): require('/home/vagrant/C. in /home/vagrant/Code/creativeforces/wp-includes/rss.php on line 117

我不知道该怎么做。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

您的PHP安装中没有

split()。它已在PHP 7中删除。

您可以使用以下代码进行验证:

<?php
echo 'PHP version is '.phpversion().'<br><br>';

$funcs = get_defined_functions();

if(in_array('split', $funcs['internal']))
{
    echo 'split() exists<br><br>';
}
else
{
    echo 'split() does not exist<br><br>';
}

sort($funcs['internal']);
echo '<pre>'.print_r($funcs['internal'], true).'</pre>';
相关问题