Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用fetch_feed函数和feed URL数组时出现有线问题_Php_Arrays_Wordpress_Rss_Explode - Fatal编程技术网

Php 使用fetch_feed函数和feed URL数组时出现有线问题

Php 使用fetch_feed函数和feed URL数组时出现有线问题,php,arrays,wordpress,rss,explode,Php,Arrays,Wordpress,Rss,Explode,我正在合并wordress中用户配置文件中的两个rss提要,其中rss提要URL用户在每行输入一个。我正在使用内爆函数来制作带有rss提要的数组,使用wordpress fetch_提要函数来检索帖子。但由于某些原因,一个url上的帖子并没有显示出来。但是当我手动创建一个具有相同URL的数组时,它就可以工作了!这是代码,您可以自己查看 //array by explode if($author->feeds){ $urlArray = explode("\

我正在合并wordress中用户配置文件中的两个rss提要,其中rss提要URL用户在每行输入一个。我正在使用内爆函数来制作带有rss提要的数组,使用wordpress fetch_提要函数来检索帖子。但由于某些原因,一个url上的帖子并没有显示出来。但是当我手动创建一个具有相同URL的数组时,它就可以工作了!这是代码,您可以自己查看

//array by explode
if($author->feeds){
                 $urlArray = explode("\r", $author->feeds);
             }
//manually created array     
    $mArray = array('http://lakeview.citystirchicago.com/feed/', 'http://citystir.com/feed/');

down in the page

     if($author->feeds){
                        if(function_exists('fetch_feed')){
                            include_once(ABSPATH . WPINC . '/feed.php');
                            $feed = fetch_feed($array);
                            if (!is_wp_error( $feed ) ){
                                $limit = $feed->get_item_quantity(8);
                                $items = $feed->get_items(0, $limit);
                                if(!$items){
                                    echo 'Problem loading feed.';
                                } else {
                                    ?>
                                    <ul id="activity_feed">
<?php
foreach ($items as $item):
//do stuff
endforeach;
?>
//分解数组
如果($author->feed){
$URLARY=explode(“\r”,$author->feed);
}
//手动创建的数组
$mArray=数组('http://lakeview.citystirchicago.com/feed/', 'http://citystir.com/feed/');
在书页下面
如果($author->feed){
如果(函数_存在('fetch_feed')){
包括一次(ABSPATH.WPINC.'/feed.php');
$feed=fetch\u feed($array);
如果(!is_wp_error($feed)){
$limit=$feed->get\u item\u数量(8);
$items=$feed->get_items(0,$limit);
如果(!$items){
echo“加载提要时出现问题”;
}否则{
?>
您可以通过这两个URL检查两个实例。我已经打印了$mArray和$urlArray两者。手动创建的数组$mArray显示来自第二个链接(新测试帖子)的帖子,而分解的数组$urlArray并不都相同,但结果不同!:

使用$mArray:

使用$URLARY:



已解决:必须将分解分隔符“\r”更改为“\r\n”。我可能必须找到更有效的分解方法。谢谢!

将分解分隔符“\r”更改为“\r\n”解决了此问题