php 正则获取文章中的图片路径
/**
* 提取body中的img-url
* @param string $body
* @return array 路径数组
*/
function getBodyImgs($body=''){
preg_match_all("/<img([^>]*)\s*src=('|\")([^'\"]+)('|\")/i",$body,$match);
return is_array($match[3])?$match[3]:array();
}
/**
* 提取body中的img-url
* @param string $body
* @return array 路径数组
*/
function getBodyImgs($body=''){
preg_match_all("/<img([^>]*)\s*src=('|\")([^'\"]+)('|\")/i",$body,$match);
return is_array($match[3])?$match[3]:array();
}