我正在尝试从 HTML 字符串中提取所有 img 标签。看代码
$d1 = file_get_contents("http://itcapsule.blogspot.com/feeds/posts/default?alt=rss");
preg_match_all('/<img[^>]+>/i',$d1,$result);
print_r($result);
结果是
Array ( [0] => Array ( ) )
但是相同的正则表达式在在线正则表达式测试工具中给出了正确的结果 http://regex.larsolavtorvik.com/ .
可能是什么问题?
最佳答案
关于PHP preg_match_all 不返回任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2352464/