我正在使用此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