2013-01-17 4 views
0

tank 인증을 사용하여 codeigniter에서 전자 메일 유효성 검사를위한 콜백 함수를 만들었습니다. 여기 내 코드는 다음과 같습니다.오류 메시지를 표시하는 대신 정의되지 않은 변수가 나타납니다.

$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email|callback_is_email_domain[gmail.com,yahoo.com]'); 

function is_email_domain($input, $domain='') 
{ 
    $email_domain=explode("@", $input); 
    $domain = explode(",", $domain); 
    if(in_array($email_domain[1],$domain)) 
    { 
     $result=1; 
    } 

    else 
    { 
     $this->form_validation->set_message('is_email_domain', 'The %s field must be a %s email address'); 
    } 

    return $result; 
} 

'gmail.com'및 'yahoo.com'이메일 만 내 웹 사이트에 등록 할 수 있도록 탱크 인증을 원합니다.

정말 고마워요!

+0

정의되지 않은 변수는 무엇입니까? – newday

+0

@Menuka - $ 결과 변수 – chums

답변

0
$email_domain is not an array but you have use it as an array `$email_domain[1]` 
+0

아! 내가 다시 시도하자. 감사! :) – chums