Home > Backend Development > PHP Tutorial > 求教一正则

求教一正则

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:28:29
Original
992 people have browsed it

<nav class="xqlj mt15">      <div class="spxq"><img src="/static/imghw/default1.png"  data-src="1.jpg"  class="lazy"      style="max-width:90%"  style="max-width:90%" alt="" border="0" /><iframe src="http://www.tudou.com/programs/view/html5embed.action?type=1&code=vZ00D1Xubu4&lcode=q711Bs57_Nw&resourceId=0_06_05_99" allowtransparency="true" allowfullscreen="true" allowfullscreeninteractive="true" scrolling="no" border="0" frameborder="0" style="width:1200px;height:500px;"></iframe></div>   </nav>
Copy after login


怎么去掉 这段里的 width 和 height


回复讨论(解决方案)

有两个width和height,你要去掉哪个?

参考: http://blog.csdn.net/fdipzone/article/details/11884285

require('HtmlAttributeFilter.class.php');$str = '<nav class="xqlj mt15">      <div class="spxq"><img src="/static/imghw/default1.png"  data-src="1.jpg"  class="lazy"      style="max-width:90%"  style="max-width:90%" alt="" border="0" /><iframe src="http://www.tudou.com/programs/view/html5embed.action?type=1&code=vZ00D1Xubu4&lcode=q711Bs57_Nw&resourceId=0_06_05_99" allowtransparency="true" allowfullscreen="true" allowfullscreeninteractive="true" scrolling="no" border="0" frameborder="0" style="width:1200px;height:500px;"></iframe></div>   </nav>';$obj = new HtmlAttributeFilter();// 允许id属性$obj->setAllow(array('src','alt','border'));$obj->setException(array());// img 标签忽略,不过滤任何属性$obj->setIgnore(array('nav','div','iframe'));echo 'source str:
';echo htmlspecialchars($str).'

';echo 'filter str:
';echo htmlspecialchars($obj->strip($str));
Copy after login

有两个width和height,你要去掉哪个?

  都去掉

谢谢大家的热心回答

Related labels:
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