我正在使用此php代码。但它给错误弃用:函数eregi()已弃用,如何解决此错误?
推荐使用:功能eregi()是 弃用 C:\ XAMPP \ htdocs中\上 线7
<?
include_once("mastersecure.php");
$emailcheck=$_POST["member_name"];
function isValidEmail($email){
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if (eregi($pattern, $email)){
return true;
}
else {
return false;
}
}
if (!isValidEmail($_POST['member_name'])){
echo "The email is invalid!";
}
else
{
$query="select email from fuel where email='$_POST[member_name]'";
$res=mysql_query($query);
$rowcount=mysql_num_rows($res);
if($rowcount!=0)
{ echo "This mail is already exits"; }
}
?>
此Any溶液燃料\ emailcheck.php ?
可能重复的[如何解决EREG函数弃用错误](http://stackoverflow.com/questions/4825205/how-to -solve-the-ereg-function-deprecated-error) – Gordon 2011-02-27 10:31:35
[PHP-Email Validation](http://stackoverflow.com/questions/4906608/php-email-validation) – Gordon 2011-02-27 10:33:54
*(相关)* [Does FILTER_VALIDATE_EMAIL制作一个字符串安全插入数据库?](http://stackoverflow.com/questions/4154685/does-filter-validate-email-make-a-string-safe-for-insertion-in-database) – Gordon 2011-02-27 10:35:00