我有問題,使用preg_match()驗證電子郵件地址。有效的電子郵件與preg_match
這是我的代碼塊。
if (VerifierAdresseMail($email))
echo '<p>valide.</p>';
else
echo '<p>not valid</p>';
function VerifierAdresseMail($adresse) {
$Syntaxe = '#^[\w.-][email protected][\w.-]+\.[a-zA-Z]{2,6}$#';
if (preg_match($Syntaxe, $adresse))
return true;
else
return false;
}
這似乎不起作用。它只是返回一個白頁。我無法看到錯誤althought我有這個在我的application.ini
[developpement : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.track_errors = 1
phpSettings.error_reporting = E_ALL
resources.frontController.params.displayExceptions = 1
phpSettings.date.timezone = "Europe/Paris"
感謝您的幫助
它在ideone http://ideone.com/Jq7FL工作;你的正則表達式需要改進 –