php安全 过滤验证转义

Posted mingzhanghui

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php安全 过滤验证转义相关的知识,希望对你有一定的参考价值。

不要相信外部源

  • $_GET
  • $_POST
  • $_REQUEST
  • $_COOKIE
  • $argv
  • php://stdin
  • php://input
  • file_get_contents()
  • 远程数据库
  • 远程api
  • 来自客户端的数据

htmlentities

<?php
$input = ‘<p><script>alert("You won the Nigerian lottery!");</script></p>‘;
echo htmlentities($input, ENT_QUOTES, ‘UTF-8‘);
// <p><script>alert("You won the Nigerian lottery!");</script></p>

  

htmlpurifier

 

以上是关于php安全 过滤验证转义的主要内容,如果未能解决你的问题,请参考以下文章