php 我在require_once行中遇到错误,请帮助我修复错误[已关闭]

wz3gfoph  于 2023-01-01  发布在  PHP
关注(0)|答案(1)|浏览(153)

这个问题是由打字错误或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
昨天关门了。
Improve this question

<?php 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require('conn.php');
require('function.php');

// if (isset($_POST['email'])) {
//  $email = $_POST['email'];

//  mysqli_query($conn, "insert into otp(email) values('$email')");
// }

$type==get_safe_value($conn, $_POST['type']);
if($type=='email'){
    $email=get_safe_value($conn, $_POST['email']);
    $otp=rand(111,9999);
    $html="$otp is your otp"

    require_once __DIR__ . '/vendor/phpmailer/src/Exception.php';
    require_once __DIR__ . '/vendor/phpmailer/src/PHPMailer.php';
    require_once __DIR__ . '/vendor/phpmailer/src/SMTP.php';

$mail = new PHPMailer(true);

$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'smtp.office365.com';
$mail->SMTPAuth = true;
$mail->SMTPSecure = "STARTTLS";
$mail->Port = 587;

$mail->mailer = "smtp";

$mail->Username = '';
$mail->Password = '';

// Sender and recipient address
$mail->SetFrom('admin@aijnsa.in', 'AIJNSA');
$mail->addAddress('support@aijnsa.in', 'AIJNSA');
$mail->addReplyTo('vishwanath@aijnsa.in', 'Vishwanath');
$mail->addcc($email, $name);

// Setting the subject and body
$mail->IsHTML(true);
$mail->Subject = "Thanks for contacting Us !!";
$mail->Body =$template;
if($mail->send()){
    echo "done";
}else{
    //echo "Error occur";
}
}
?>

解析错误:语法错误,第23行的D:\anand\htdocs\aijnsa.in\public_html\send_otp. php中出现意外的标记"require

kuuvgm7e

kuuvgm7e1#

$html="$otp is your otp"中缺少分号。它应该是$html="$otp is your otp";

相关问题