CakePHP: h() vs. Sanitize::html()

懵懂的女人 提交于 2019-12-04 09:57:14
Costa

Sanitize::html() is more versatile: it lets you strip the HTML completely (via remove option), and lets you specify the how it handles quoting.

See the source code:
h(): http://api.cakephp.org/2.3/source-function-h.html#160-199
Sanitize::html(): http://api.cakephp.org/2.3/source-class-Sanitize.html#83-122

EDIT:
h(): calls htmlspecialchars()
Sanitize::html(): calls htmlentities()

For discussion on differences, see: htmlentities() vs. htmlspecialchars()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!