htmlentities() vs. htmlspecialchars()

前端 未结 12 2002
走了就别回头了
走了就别回头了 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:21

    You probably want to use some Unicode character encoding, for example UTF-8, and htmlspecialchars. Because there isn't any need to generate "HTML entities" for "all [the] applicable characters" (that is what htmlentities does according to the documentation) if it's already in your character set.

提交回复
热议问题