2012-05-08 2 views
-1

내가 틀린 사이트를 찾기 위해 다른 사이트를 검색했지만 예기치 않은 $ END 구문 분석 오류가 계속 발생합니다. 내 코드를 살펴보고 내가 뭘 잘못하고 있는지 말해 줄 수 있니?

 <!DOCTYPE html> 
     <html> 

    <head><meta name=Campus DrinkThink API Page/> 
     <title> Campus DrinkThink API Page </title> 
    </head> 
    <body> 
    <?php 


       // has the user taken the quiz before? 
       if (isset($_COOKIE['visit_id'])) {                 

     // if so, look up their answers in the JSON file 
     $visit_id = $_COOKIE['visit_id'];                 
     $all_my_variables = json_decode(file_get_contents("/var/www/html/data/$visit_id.json"), TRUE); 
     $location= $all_my_variables -> location; 

     echo "<h1>Your Night Out in Depth!</h1>"; 

     // make an API call to find what kind of place they typed in 
     $google_maps_array = json_decode(
      file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='. 
       urlencode(
        htmlspecialchars_decode(
         $all_my_variables['location'] 
        ) 
       ) . "&sensor=false" 
      ), TRUE 
     ); 
     $google_map_image= json_decode(file_get_contents("http://maps.googleapis.com/maps/api/staticmap?center=". 
      urlencode($location)."&zoom=20&size=400x400"), 
      TRUE 
      ); 

      // remind them of their quiz answers 
     echo "<p>When you used Campus DrinkThink"; 
     echo "You said that you were located at,: <b>"; 
     echo $all_my_variables['location'];                 
     echo "</b>.</p>";  


     // handle the situation where there is no result 
     if ($google_maps_array['status'] == 'ZERO_RESULTS') 
      {           
      echo "<p>Google Maps can't find you at this time! Sorry!</p>"; 
     // otherwise, if there is a result 
    } else {    
      // output the place type by looking in the first [0] 
      // type element in the first [0] result element 
      echo "<p>Google Maps says that this is a location type called: <strong>"; 
      echo $google_maps_array["results"][0]["types"][0];           
     echo "</strong></p>"; 

    } 

    }else { // no cookie is set                  

      // you didn't use the app 

     echo "<p>You have not yet used Campus DrinkThink</p>"; 
     print "<a href='http://haleysoehn.com/campusdrinkthink-form.html'> Click Here For the Quiz </a>"; 
     echo "Then return here to see your explained results"; 
    ?> 

    </body> 
</html> 
+0

마지막으로 다른 항목을 닫았습니까? –

+0

http://stackoverflow.com/questions/3128468/unexpected-end –

+0

메타 값도 인용해야합니다. – JakeParis

답변

3

이 줄

}else { // no cookie is set  

없는이 중괄호 }

1

닫는 것 당신은 당신이 편집기를 사용해야합니다 // no cookie is set

옆에 열린 마지막 브래킷을 닫지 않았다 도움을주는 구문 강조.

if (isset($_COOKIE['visit_id'])) { 

당신은 단지 PHP를 닫는 태그 전에 닫아야합니다 : 메모장 ++

0

는 당신은 라인 (12)에 if 문이를 닫을 필요로 이클립스가 좋다.