Undefined PHP function filter
I am trying to use the predefined function in PHP filter_input
But I get the following: Call to undefined function filter_input()...
The line it fails on is:
$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
I can confirm there is a $_POST['email']
that has a value and that I am using PHP 5.5.12 and the filter extension was enabled by default in 5.2.0 .
I'm not sure what I am missing to access the function that should be already accessible.
$error_msg = ""; if (isset($_POST['email'], $_POST['p'])) { // Sanitize and validate the data passed in $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); $email = filter_var($email, FILTER_VALIDATE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // Not a valid email $error_msg .= 'The email address you entered is not valid'; } $password = filter_input(INPUT_POST, 'p', FILTER_SANITIZE_STRING); }
There isn't much code. It doesn't make it too far yet...
链接地址: http://www.djcxy.com/p/92694.html上一篇: PHP中的正则表达式问题
下一篇: 未定义的PHP函数过滤器