Why is better to use filter_input()?

后端 未结 3 806
梦谈多话
梦谈多话 2020-12-16 11:46

This should be a elementary question but why is better to use something like this:

$pwd = filter_input(INPUT_POST, \'pwd\');

Instead of jus

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 12:19

    Any data which is sent from the client (such as POST data) should be sanitized and escaped (and even better, sanity-checked) to ensure that it isn't going to kill your website.

    SQL Injection and Cross-site scripting are the two largest threats for failing to sanitize your user-sent data.

提交回复
热议问题