我正在使用PhpStorm,它说此if语句不是最佳的。不幸的是,它没有说明原因。
谁能告诉我这不是最优的?
if ($this->tokens[$next_token_ptr]['code'] === T_ARRAY) {
$next_token_ptr = $this->tokens[$this->tokens[$next_token_ptr]['parenthesis_opener']]['parenthesis_closer'];
} else if ($this->tokens[$next_token_ptr]['code'] === T_OPEN_SHORT_ARRAY) {
$next_token_ptr = $this->tokens[$next_token_ptr]['bracket_closer'];
} else {
// T_CLOSURE.
$next_token_ptr = $this->tokens[$next_token_ptr]['scope_closer'];
}
答案 0 :(得分:0)
该错误是由“ Php检查”插件报告的。
问题是该表达式只能执行一次时执行两次
public function validate()
{
$name = $this->input->post("name");
$email =$this->input->post("email");
$captcha =$this->input->post("captcha");
$message =$this->input->post("message");
$captcha_code =$this->session->userdata("captcha_code");
if($captcha == $captcha_code){
$this->load->library("PHPMailer_Library");
$objMail = $this->phpmailer_library->load();
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'proxyemu19@gmail.com';
$mail->Password = '****';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->setFrom('proxyemu19@gmail.com');
$mail->addAddress('cugurel7@gmail.com');
$mail->isHTML(true);
$mail->Subject = 'Ziyaretçi Form Mesajı';
$mail->Body ="Ziyaretçi ismi: ". $name."<br>Ziyaretçi mail adresi ".$email."<br> Ziyaretçi e-posta: ".$message;
$mail->AltBody = strip_tags($message);
$mail->send();
echo 'Message has been sent';
} catch (Exception $e)
{
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
}else{
echo "Doğrulama kodu yanlıştır";
}
}
谢谢