【问题标题】:I'm getting undefined variable instead of displaying the error message我得到未定义的变量而不是显示错误消息
【发布时间】:2012-12-31 13:06:15
【问题描述】:

我使用 tank auth 在 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;
}

我希望 tank auth 仅允许“gmail.com”和“yahoo.com”电子邮件在我的网站上注册。

非常感谢!

【问题讨论】:

  • 什么是未定义的变量?
  • @Menuka - $result 变量

标签: codeigniter email tankauth


【解决方案1】:
$email_domain is not an array but you have use it as an array `$email_domain[1]`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-19
    • 1970-01-01
    • 1970-01-01
    • 2016-07-23
    相关资源
    最近更新 更多