未定义的索引:第191行的C:\ xampp \ htdocs \ car-config \ application \ controllers \ www \ home.php中的电子邮件

时间:2016-06-24 07:08:03

标签: php indexing undefined

我在尝试执行此代码时遇到问题。这只是我代码的一部分

  

未定义的索引:第191行的C:\ xampp \ htdocs \ car-config \ application \ controllers \ www \ home.php中的电子邮件

private function sendMail(){

    $objConfig = Userconfig::newObj();
    $objConfig->email = $this->arrRequest['email'];
    $objConfig->name = $this->arrRequest['name'];
    $objConfig->configuration = serialize($this->arrRequest);
    $objConfig->save();

    $strMessage = 'Configuratia a fost salvata!';

    $this->arrRequest['success'] = $strMessage;


    if(empty($this->arrRequest['name']) || empty($this->arrRequest['email']) || filter_var($this->arrRequest['email'], FILTER_VALIDATE_EMAIL)){
        return false;
    }

1 个答案:

答案 0 :(得分:0)

if(!isset($this->arrRequest['email']) ||!isset($this->arrRequest['name']) || empty($this->arrRequest['name']) || empty($this->arrRequest['email']) || filter_var($this->arrRequest['email'], FILTER_VALIDATE_EMAIL)){
        return false;
    }

    $objConfig = Userconfig::newObj();  
    $objConfig->email =$this->arrRequest['email'];
    $objConfig->name = $this->arrRequest['name'];
    $objConfig->configuration = serialize($this->arrRequest);
    $objConfig->save();

    $strMessage = 'Configuratia a fost salvata!';

    $this->arrRequest['success'] = $strMessage;

error_reporting(E_ERROR);
ini_set("display_errors",1);