Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.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 从包含图像的内容获取图像url_Php_Html_Regex - Fatal编程技术网

Php 从包含图像的内容获取图像url

Php 从包含图像的内容获取图像url,php,html,regex,Php,Html,Regex,我正在建立一个供个人使用的小型cms系统。其中一部分要求我获取文章中的第一个图像url。我该怎么做 变量中的示例文章内容$article <p> <img src="/images/userContent/2013-07-12%2022_27_34.png"> The griefing problem has been curbed! </p> 抱怨的问题已经得到了控制! 如何获取url/images/userContent/2013-07-12%20

我正在建立一个供个人使用的小型cms系统。其中一部分要求我获取文章中的第一个图像url。我该怎么做

变量中的示例文章内容
$article

<p>
<img src="/images/userContent/2013-07-12%2022_27_34.png">
The griefing problem has been curbed!
</p>

抱怨的问题已经得到了控制!

如何获取url
/images/userContent/2013-07-12%2022\u 27\u 34.png

可能是正则表达式?如果是,如何进行?我对正则表达式一无所知使用该类:


使用正则表达式解析(X)HTML可能会出现重复。正确回答@Javier如果OP访问了Mike的链接,他可能会找到答案。
<p>
<img src="/images/userContent/2013-07-12%2022_27_34.png">
The griefing problem has been curbed!
</p>
/images/userContent/2013-07-12%2022_27_34.png