<?php header("Content-type:text/html;charset=utf-8"); $str = '<p> <img src="http://localhost/js/umeditor/php/upload/20160730/146988951333.jpg" _src="http://localhost/js/umeditor/php/upload/20160730/146988951333.jpg"/></p>' . '<p><img src="http://localhost/js/umeditor/php/upload/20160730/14698896174705.jpg" _src="http://localhost/js/umeditor/php/upload/20160730/14698896174705.jpg"/></p>'; $preg="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";php
preg_match_all($preg, $str, $imgArr);html
print_r($imgArr[1]);url
//================如下是獲取圖片類型==================htm
$url = 'http://img1.epetbar.com/2015-11/06/16/8d1d14dba810f0ec291ee937b362e63e.png.jpg';圖片
$img = substr($url, strrpos($url, '/')+1);utf-8
echo $img;echo '<br/>';get
//獲取圖片後綴it
$type = substr($url, strrpos($url, '.'));im
echo $type;echo '<br/>';db
//獲取圖片名(不包括後綴)
$name = substr($img, 0, strrpos($img, '.'));
echo $name;