2012-05-08 10 views
-1

私は何が間違っているのかを見るために別のサイトを探していましたが、予期しない$ ENDというParseエラーが発生しています。おそらく私のコードを見て、私が間違っていることを教えてください。

 <!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

の隣にオープンした最後のブラケットを閉じませんでした助けになる構文強調表示。 Eclipseのメモ帳++

0

あなたはこれを閉じる必要がありますが、12行目のif文であるとして、良いです:あなたはPHPの終了タグの前にそれを閉じる必要があります

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

関連する問題