美文网首页
php替换富文本框返回图片路径

php替换富文本框返回图片路径

作者: 木丿灬易 | 来源:发表于2020-07-07 14:03 被阅读0次
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;
}

相关文章

网友评论

      本文标题:php替换富文本框返回图片路径

      本文链接:https://www.haomeiwen.com/subject/tymaqktx.html