htmlentities() vs. htmlspecialchars()

前端 未结 12 2192
走了就别回头了
走了就别回头了 2020-11-22 02:50

What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?

12条回答
  •  迷失自我
    2020-11-22 03:12

    htmlspecialchars () does the minimum amount of encoding to ensure that your string is not parsed as HTML. This leaves your string more human-readable than it would be if you used htmlentities () to encode absolutely everything that has an encoding.

提交回复
热议问题