Home  >  Article  >  Backend Development  >  Disadvantages of using htmlspecialchars to encode special characters in PHP

Disadvantages of using htmlspecialchars to encode special characters in PHP

WBOY
WBOYOriginal
2016-07-29 08:51:28939browse

When using htmlspecialchars to encode special characters (&, ', ", <, >) in the parameters passed by the form (due to the need for security filtering when inserting into the database), the following problems will occur.

If the user uploads a file with special characters, such as ', the following problem will occur when the file name is saved to the database


Disadvantages of using htmlspecialchars to encode special characters in PHP

If your server-side PHP code passes $_GET[' id'] indirectly to obtain its file name, and then transfer it to the client by name.

?

Then the following file name error will occur when downloading


Disadvantages of using htmlspecialchars to encode special characters in PHPPersonal homepage:
https://plus.google.com/+sherlockwang/posts

Original link: http://woqilin.blogspot.com/2012/10/php-htmlspecialchars.html

The above has introduced the disadvantages of using htmlspecialchars to encode special characters in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

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