gpt4 book ai didi

php - 尝试循环的语法错误

转载 作者:行者123 更新时间:2023-12-03 08:24:05 24 4
gpt4 key购买 nike

我不断收到语法错误

Parse error: syntax error, unexpected '{' in contact_form.php on line 18

但我似乎找不到它,这是代码
<?php
require_once('classes/class.phpmailer.php');
include_once("classes/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
include_once("includes/contact_form_constants.php");
include('funcs.php');
$errors='';
if((isset($_FILES['file']))&&(($_FILES['file']['error']==2)||($_FILES['file'] ['error']==1))){
echo "The file you tried to upload is too large. Please try again with a smaller file 2";
header('Location: ../result.php?title=Form Submission&msg=3');
}else if(($_FILES['file']['name']!=='')&&($_FILES['file']['error']>2) &&($_FILES['file'] ['error']!==4)){
$msg = 'apperently there has been an error in the contact form from the electropolishing contact form, should probably get on it<br/>';
$msg.= 'here is some information on the file that the user tried to upload<br />';
$msg.= 'the error that was give was code #'.$_FILES['file']['error'].'<br/>';
$msg.= 'You can find more information about on the codes <a href="http://php.net/manual/en/features.file-upload.errors.php">here.</a><br/>';
$msg.= "<br/> sent on ".date('l jS \of F Y h:i:s A');
$error_email = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$error_email->IsSMTP(); // telling the class to use SMTP
//this is line 18
try {
//end of line 18
$error_email->SMTPDebug = 1; // enables SMTP debug information (for testing)
$error_email->SMTPAuth = true; // enable SMTP authentication
$error_email->SMTPSecure = "ssl";

我已经在我的本地环境中测试了相同的代码,没有任何问题,但是我使用的主机正在运行php 4.4.9,我不知道这是否是问题所在

最佳答案

PHP 5 has an exception model similar to that of other programming languages.



( Source)

PHP 4不支持 try..catch

关于php - 尝试循环的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9441965/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com