2012-02-25 3 views
0

나는 구문 오류구문 오류가

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"; 

내가이 동일한 코드를 테스트 한을 heres 코드를 찾을 수있을 수없는 것 내 문제가없는 것 같은데도 문제없이 호스트 환경에서 PHP 4.4.9를 실행 중입니다. 문제가 될지 모르겠다.

+0

여기서 try 블록의 끝 "}"은 무엇입니까? –

+0

PHP를 버전 5.x로 업데이트하면 문제가 없습니다. –

답변

2

PHP 5의 예외 모델 다른 프로그래밍 언어와 유사합니다.

(Source)

PHP 4 try..catch을 지원하지 않는다.