php从字符串中提取图片URL

<?php

$str = '<p></p><p><img src="http://localhost:8100/static/uploads/images/2021/11/25/1637807129619ef419496b7.jpg"/></p><p><img src="http://localhost:8100/static/uploads/images/2021/11/25/1637807129619ef4194d23c.jpg"/></p><p><img src="http://localhost:8100/static/uploads/images/2021/11/25/1637807129619ef4194d23c.jpg"/></p><p><br/></p>';

preg_match_all('#src=[^<]+[^>]+.jpg#', $str, $matches);

print_r($matches);

    原文作者:firstcode666
    原文地址: https://blog.csdn.net/firstcode666/article/details/121601557
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞