filter_var in php 5.3.8

后端 未结 4 1452
误落风尘
误落风尘 2021-01-20 01:51

I am developing a user registration form and want to validate a user\'s email address. However,all the php docs I have read suggest the use of filter_var. My script validate

4条回答
  •  一整个雨季
    2021-01-20 02:32

    In your case you shouldn't use filter_var, but filter_input. This is all the code you would need:

    if ($email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) {
        // email was submitted and is a valid email
    }
    

    This bug might be related to your problem though.

提交回复
热议问题