Php preg_match_all返回空数组
我从rss网站为finde.mp3链接编写php程序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;
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... 用于展示目的。