Home  >  Article  >  Backend Development  >  PHP中HTML标签过滤技巧_php技巧

PHP中HTML标签过滤技巧_php技巧

WBOY
WBOYOriginal
2016-05-17 08:51:281079browse

在开发文章系统中正常需要用到HTML标签、JS脚本等其他脚本代码的过滤,稍微尝试了下,感觉简单的htmlspecialchars()函数的过滤效果始终不如strip_tags()函数的过滤效果好。
其中有人会说我就想还要显示点图片,那怎么办呢?

没关系,我们对文章内容进行二次处理,正则找出某个图片的地址,然后对整个布局动态调控下,将图片放到最后,其效果还有可能会达到微博或者是Q空间动态的那种效果,多一举两得啊!

Statement:
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