php从HTML中获取所有的图片地址

/**
 * @param $content
 * @return null
 *  从HTML文本中提取所有图片
 */
function get_images_from_html($content){
    $pattern="//";
    preg_match_all($pattern,htmlspecialchars_decode($content),$match);
    if(!empty($match[1])){
        return $match[1];
    }
    return null;
}

你可能感兴趣的:(php)