[英]preg_match_all return empty array
我從網站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;
}
但是,它返回空數組!!! Array()Array()Array()Array()Array()Array()Array()Array()Array()Array()
但是我在http://regex101.com/中測試,它有35個匹配結果!
只需保留最后2個參數。 參數標志不能為空,而是PREG_PATTERN_ORDER或PREG_SET_ORDER
preg_match_all($newReg, $content, $matches);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.