首页 > 技术文章 > php防止用户输入进行跨站攻击的方式

theWayToAce 2017-11-27 17:47 原文

1.对用户输入的内容进行转义

//1.过滤内容中html标记
$userinput=strip_tags($userinput);
//2.转换成HTML实体
$userinput=htmlentities($userinput);

 

推荐阅读