我想要字符串中“img”标签内的内容。例如:- 如果
str="< img src="/files/thumbnails/001.simonhiggins_comm games_thumb.jpg" title="Commonwealth Games" alt="showreel" class="clear-right-margin" />"
然后我想使用 preg_split 进行操作,如下所示:-
src="/files/thumbnails/001.simonhiggins_comm games_thumb.jpg" title="Commonwealth Games" alt="showreel" class="clear-right-margin"
我用下面的代码找出来
$x = preg_split('/<img(.*?)>/',$p,-1,PREG_SPLIT_DELIM_CAPTURE);
但在某些情况下它无法正常工作,例如: - 如果图像标签内有空格或空行。