Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.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 preg_match_all返回空数组_Php_Arrays_Rss - Fatal编程技术网

Php preg_match_all返回空数组

Php preg_match_all返回空数组,php,arrays,rss,Php,Arrays,Rss,我从rss网站为finde.mp3链接编写php程序 try{ $con = new SimpleXMLElement('http://www.taktarane.ir/feed',NULL,TRUE); foreach ($con->channel->item as $items) { $content = $items->children('content', true)->encoded;

我从rss网站为finde.mp3链接编写php程序

     try{
        $con = new SimpleXMLElement('http://www.taktarane.ir/feed',NULL,TRUE);
        foreach ($con->channel->item as $items) {
            $content = $items->children('content', true)->encoded;
            $newReg = "/(http)(s?)(\:\/\/)(www\.)(.{5,120})(\.)(mp3|zip)/i";
            preg_match_all($newReg, $content, $matches, null, 0);
            print_r($matches);
        }
    }catch (Exception $ex){
            echo $ex;
    }
但是,它返回空数组!!! 大堆 大堆 大堆 大堆 大堆 大堆 大堆 大堆 大堆 大堆


不过我测试在它有35个匹配结果

只需保留最后两个参数。参数标志不能为null,但可以是PREG_PATTERN_ORDER或PREG_SET_ORDER

  preg_match_all($newReg, $content, $matches);
->编码的?如URL编码?如果是这种情况,您的字符串很可能是http%3A%2F%2Fwww…,您的浏览器正在恢复正常http://www... 用于展示目的。