function replaceMipImages($content)
{
preg_match_all('/<img (.*?)\>/', $content, $images);
if(!is_null($images)) {
foreach($images[1] as $index => $value){
$mip_img = str_replace('<img', '<mip-img', $images[0][$index]);
$mip_img = str_replace('>', '></mip-img>', $mip_img);
//以下代码可根据需要修改/删除
$mip_img = preg_replace('/(width|height)="\d*"\s/', '', $mip_img );//移除图片width|height
$mip_img = preg_replace('/ style=\".*?\"/', '',$mip_img);//移除图片style
$mip_img = preg_replace('/ class=\".*?\"/', '',$mip_img);//移除图片class
//以上代码可根据需要修改/删除
$content = str_replace($images[0][$index], $mip_img, $content);
}
}
return $content;
}

最新文章

  1. Spring和SpringMVC父子容器关系初窥
  2. 【230】4T硬盘如何完全利用(GPT)
  3. jquery输入数字随机抽奖特效
  4. MYSQL的锁介绍,以及死锁发生情况-带例子
  5. java语句类型
  6. linux 列出安装包内的文件
  7. Mysql 建表时,日期时间类型选择
  8. $Django RESTful规范
  9. Sublime text 3搭建Python开发环境及常用插件安装
  10. Spring ApplicationListener使用方法及问题
  11. ThinkPHP验证码类的使用
  12. SAP Overview
  13. zsh与oh-my-zsh
  14. C#-流、存储
  15. block本质探寻六之修改变量
  16. opensips安装
  17. MySQL 开启事件 使用定时器调用存储过程
  18. 【Python】循环设计
  19. 【eclipse新增系列】eclipse新安装设计编码统一
  20. Oracle RMAN 学习:恢复

热门文章

  1. SpringBoot LoggerFactory is not a Logback LoggerContext but Logback is on the classpath
  2. 【转】Java8中list转map方法总结
  3. vue 之 render 函数不能渲染非全局自定义函数-方案
  4. Spring入门篇——AOP基本概念
  5. httprunnermanager环境搭建 -----转
  6. Java中程序初始化的顺序
  7. idea 复制多条字符串
  8. 后端数据中含有html标签和css样式,前端如何转译展示样式效果。
  9. BZOJ 3901 棋盘游戏 (找结论+枚举+贪心)
  10. sync、fsync和fdatasync