What is the correct way to detect whether string inputs contain HTML or not?

前端 未结 13 769
旧时难觅i
旧时难觅i 2020-12-23 15:08

When receiving user input on forms I want to detect whether fields like \"username\" or \"address\" does not contain markup that has a special meaning in XML (RSS feeds) or

13条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 15:30

    filter_input + FILTER_SANITIZE_STRING (there are lots of flag you can chose from)

    :- http://www.php.net/manual/en/filter.filters.sanitize.php

提交回复
热议问题