从html中提取img标签

function getSimpleImg($str = '')
{
    if (!empty($str)) {
        $result = preg_replace("/.*<img[^>]*src[=\s\"\']+([^\"\']*)[\"\'].*/", "$1", $str);
    } else {
        $result = '';
    }
    return $result;
}

猜你喜欢

转载自blog.csdn.net/Mr_Yanghao/article/details/82221432
今日推荐