PHP fonksiyon boş dönmüyor ama ya bir şey dönmüyor

0 Cevap

İşte uzun bir PHPMailer kullanan benim kodudur. Ben firstResult ve lastResult için kontrol ederseniz, ama ben emailResult kontrol değilse Bu çalışır:

$validator = new FormValidator();
            $firstResult = $validator->checkFirst($_POST['firstname']);
            $lastResult = $validator->checkLast($_POST['lastname']);
            $emailResult = $validator->checkEmail($_POST['emailaddress1']);
            var_dump($emailResult);
            if (is_null($firstResult) && is_null($lastResult) && is_null($emailResult)) {

                $mail = new ULSMail();

                $mail->IsSMTP();  // telling the class to use SMTP
                $mail->AddAddress("shummel@ulsinc.com");

                $mail->Subject  = "test";
                $mail->MsgHTML($messageHTML);

                redirectULS('english/forms/thankyou.php');

                if(!$mail->Send()) {
                    echo 'Message was not sent.';
                    echo 'Mailer error: ' . $mail->ErrorInfo;
                } else {

                    //$bridge->pushLead($lead);
                }
            } else {
                //...
            }

ve benim FormValidator sınıfta:

function checkEmail($email){

        if(strlen(trim($email)) < 8){
        return 'Please enter a valid email address of more than 8 characters</span>';
    } else {
        return NULL;
    }

}

redirectULS sitemde dahili yönlendirmeler için basit bir yönlendirme işlevidir. Bu sürece ben $ emailResult kontrol yok gibi çalışır.

0 Cevap