2014-12-03 230 views
1

我想創建一個簡單的網上商店,其中有幾個客戶需要填寫的表單。填充後,我使用Pear Validate.php驗證它們。梨電子郵件驗證

$validate = new Validate(); 

$options = array("check_domain"=>true,"use_rfc822"=>true); 

$test = $validate->email("$epost",$ehdot); 
if (!($test)) { 
    $checks = false; 
    echo 'EMAIL IS WRONG </p>'; 

} 

$ epost是電子郵件客戶插入到電子郵件的形式。 出於某種原因,它拋出一個錯誤是這樣的:

Strict Standards: Only variables should be passed by 
reference in /home2-3/e/anon/public_html/php/verkkostore/Validate.php on line 586 

下面是從Validate.php的代碼行586

$domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email))); 

提前感謝!

+0

'$ pop = array_pop(explode('@',$ email)); $ domain = preg_replace('/ [^ - a-z.0-9]/i','',$ pop);'可以工作。 – 2014-12-03 17:38:00

+0

^^^工作,是/否/去過午餐? – 2014-12-03 17:46:15

+0

隨意去吃午飯。無論如何,我需要過一會兒 – Miifor 2014-12-03 17:48:33

回答

1

好吧這是我如何修復它。感謝您的幫助,它讓我走上了正確的道路!

$array = explode('@', $email); 
$pop = array_pop($array); 
$domain = preg_replace('/[^-a-z.0-9]/i', '', $pop);