<nav class="xqlj mt15"> <div class="spxq"><img src="1.jpg" width="1200" 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>
有两个width和height,你要去掉哪个?
参考: http://blog.csdn.net/fdipzone/article/details/11884285
require('HtmlAttributeFilter.class.php');$str = '<nav class="xqlj mt15"> <div class="spxq"><img src="1.jpg" width="1200" 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));
有两个width和height,你要去掉哪个?
都去掉谢谢大家的热心回答
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号