- public function imageUrl($content) {
- $url = "http://".$_SERVER['SERVER_NAME'];
- $pregRule = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/";
- $list = preg_replace($pregRule, '<img src="'.$url.'${1}" style="max-width:100%">', $content);
- return $list;
- }
来源: http://www.bubuko.com/infodetail-2716349.html