Home > Backend Development > PHP Tutorial > PHP如何使用正则删除文章中的img的样式

PHP如何使用正则删除文章中的img的样式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:20:41
Original
1249 people have browsed it


这是原始代码

<p><span style="font-size: 14px"><strong>这里是小标题</strong></span></p><p>据统计,自行动开展以来,北京全市56个外围公安检查站已累计查获劣质烟花爆竹3500余公斤</p><br /><img src="/static/imghw/default1.png"  data-src="http://127.0.0.1/upload/article/3/1_1450768388_8019104.png"  class="lazy"  alt="测试图测试图"    style="max-width:90%"  style="max-width:90%" /><br /><br /><img src="/static/imghw/default1.png"  data-src="http://127.0.0.1/upload/article/3/1_1450918929_9870605.jpg"  class="lazy"  alt="测试图测试图1"    style="max-width:90%" />
Copy after login



我想达到的效果是
<p><span style="font-size: 14px"><strong>这里是小标题</strong></span></p><p>据统计,自行动开展以来,北京全市56个外围公安检查站已累计查获劣质烟花爆竹3500余公斤</p><br /><img src="/static/imghw/default1.png"  data-src="http://127.0.0.1/upload/article/3/1_1450768388_8019104.png"  class="lazy"  alt="测试图测试图"  /><br /><br /><img src="/static/imghw/default1.png"  data-src="http://127.0.0.1/upload/article/3/1_1450918929_9870605.jpg"  class="lazy"  alt="测试图测试图1"  />
Copy after login


回复讨论(解决方案)

$s = <<这里是小标题

据统计,自行动开展以来,北京全市56个外围公安检查站已累计查获劣质烟花爆竹3500余公斤


测试图测试图

测试图测试图1TXT;echo preg_replace('/(PHP如何使用正则删除文章中的img的样式

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template