2017-01-14 83 views
0

我的本地主機(XAMPP)和在線服務器上有PHP網站設置。在本地主機,當我嘗試運行的網站我得到這個錯誤:解析錯誤:語法錯誤,XAMPP服務器上的文件意外結束

解析錯誤:語法錯誤,在C意外的文件結尾:\ XAMPP \ htdocs中\在線網站\的index.php 304

然而相同的代碼在在線服務器上正常工作。

這裏是如何看起來像:

<?php 
$file = "admin/data/home.txt"; 
$fileproduct = "admin/data/product.txt"; 
$fileseo = "admin/data/seohome.txt"; 
$filesm = "admin/data/smhome.txt"; 
$filevideo = "admin/data/video.txt"; 

if (file_exists($file)) $data = json_decode(file_get_contents($file)); 
if (file_exists($fileproduct)) $dataproduct = json_decode(file_get_contents($fileproduct)); 
if (file_exists($fileseo)) $dataseo = json_decode(file_get_contents($fileseo)); 
if (file_exists($filesm)) $datasm = json_decode(file_get_contents($filesm)); 
if (file_exists($filevideo)) $datavideo = json_decode(file_get_contents($filevideo)); 

    include('includes/header.php'); 

    switch($settings->currency) { 
     case 'USD': $sym = '$'; break; 
     case 'GBP': $sym = '£'; break; 
     case 'EUR': $sym = '€'; break; 
    } 

$allDataSM = array(
    0 => array('title' => 'Twitter Followers', 'name' => 'tw_fo_tx', 'price' => 'tw_fo_pr', 'image' => 'twitter.png'), 
    1 => array('title' => 'Instagram Followers', 'name' => 'in_fo_tx', 'price' => 'in_fo_pr', 'image' => 'instagram.png'), 
    2 => array('title' => 'Facebook Like', 'name' => 'fb_lk_tx', 'price' => 'fb_lk_pr', 'image' => 'facebook.png'), 
    3 => array('title' => 'Youtube Views', 'name' => 'yo_vw_tx', 'price' => 'yo_vw_pr', 'image' => 'youtube.png'), 
    4 => array('title' => 'Twitter Retweet', 'name' => 'tw_rt_tx', 'price' => 'tw_rt_pr', 'image' => 'twitter.png'), 
    5 => array('title' => 'Instagram Likes', 'name' => 'in_lk_tx', 'price' => 'in_lk_pr', 'image' => 'instagram.png'), 
    6 => array('title' => 'Facebook Shares', 'name' => 'fb_sh_tx', 'price' => 'fb_sh_pr', 'image' => 'facebook.png'), 
    7 => array('title' => 'Youtube Subscribes', 'name' => 'yo_su_tx', 'price' => 'yo_su_pr', 'image' => 'youtube.png') 
); 

$allDataSEO = array(
    0 => array('title' => 'BACKLINK PACKAGES', 'name' => 'tw_fo_tx', 'price' => 'tw_fo_pr', 'image' => 'backlinks.png'), 
    1 => array('title' => 'PRESS RELEASES', 'name' => 'in_fo_tx', 'price' => 'in_fo_pr', 'image' => 'pressreleases.png'), 
    2 => array('title' => 'CONTENT WRITING', 'name' => 'fb_lk_tx', 'price' => 'fb_lk_pr', 'image' => 'articlewriting.png'), 
    3 => array('title' => 'ARTICLE SUBMISSIONS', 'name' => 'yo_vw_tx', 'price' => 'yo_vw_pr', 'image' => 'articlesubmission.png'), 
    4 => array('title' => 'SOCIAL BOOKMARKING', 'name' => 'tw_rt_tx', 'price' => 'tw_rt_pr', 'image' => 'socialbookmarking.png'), 
    5 => array('title' => 'VIDEO MARKETING', 'name' => 'in_lk_tx', 'price' => 'in_lk_pr', 'image' => 'videomarketing.png'), 
    6 => array('title' => 'LINK INDEXING', 'name' => 'fb_sh_tx', 'price' => 'fb_sh_pr', 'image' => 'linkindexing.png'), 
    7 => array('title' => 'SOCIAL ACCOUNTS', 'name' => 'yo_su_tx', 'price' => 'yo_su_pr', 'image' => 'socialaccounts.png') 
); 
?> 
<!-- Site Description --> 
<div class="presentation container"> 
    <h2><?php echo $data->main_headline != '' ? stripslashes($data->main_headline) : 'We are <span class="violet">SocialPiggy</span>, a viral marketing company.'; ?></h2> 
    <p><?php echo $data->main_headline != '' ? stripslashes($data->sub_headline) : 'We create viral buzz around the internet...'; ?></p> 
</div> 
<?php if (isset($data->hero_enable) && $data->hero_enable == 1){ ?> 
<div class="what-we-do container hero"> 
<div class="row"> 
<div class="span6 <?php echo $data->hero_video_position == "left"? "" : "right"; ?>"> 
<?php echo stripslashes($data->hero_video); ?> 
</div> 

<div class="span6"> 
    <h2><?php echo $data->hero_title != '' ? stripslashes($data->hero_title) : 'We are <span class="violet">SocialPiggy</span>, a viral marketing company.'; ?></h2> 
    <p><?php echo $data->hero_desc != '' ? stripslashes($data->hero_desc) : 'We create viral buzz around the internet...'; ?></p> 
</div> 
</div> 
</div> 
<?php } ?> 
<?php 
    $fixed_str = ' <input type="hidden" name="cmd" value="_cart"> 
        <input type="hidden" name="business" value="'.$settings->paypal.'"> 
        <input type="hidden" name="lc" value="US"> 
        <input type="hidden" name="add" value="1">'; 
    $btn = '<input type="submit" class="btn_new" value="Buy Now" />'; 
?> 
    <!-- Videos --> 
<?php if (isset($datavideo->video_enable) && $datavideo->video_enable == 1){ ?> 
    <div class="what-we-do container"> 
     <div class="row"> 
      <?php 

      for ($i = 1; $i < 5; $i++) { 

       for ($j = 1; $j <= $settings->total_videos; $j++) 
       { 
        if ($datavideo->video_name->$j == $data->video->$i) 
        { 
         ?> 
         <div class="service span6 productbox"> 
          <p class="mg15"></p> 
          <div class=""> 
           <?php echo '<iframe width="560" height="280" src="'.str_replace("watch?v=", "embed/",$datavideo->link->$j).'?showinfo=0&controls=0&rel=0" frameborder="0" allowfullscreen></iframe>'; ?> 
          </div> 
          <div class="left span5 spleft"><h4><?php echo stripslashes($datavideo->video_name->$j); ?></h4><p><?php echo stripslashes($datavideo->video_desc->$j); ?></p> 
           <!-- <p></p>Price : <?php echo $sym. $datavideo->price->$j; ?><br><p></p><p></p>--> 
           <form id="signup" action="<?php echo paypal_path; ?>" method="post"> 
            <input type="hidden" name="cmd" value="_cart"> 
            <input type="hidden" name="business" value="<?php echo $settings->paypal; ?>"> 
            <input type="hidden" name="lc" value="US"> 
            <input type="hidden" name="add" value="1"> 
            <input type="hidden" name="item_name" value="<?php echo stripslashes($datavideo->video_name->$j); ?>"> 
            <input type="hidden" name="amount" value="<?php echo $datavideo->price->$j; ?>"> 
            <input type="hidden" name="return" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/thankyou.php'; ?>"> 
            <input type="hidden" name="currency_code" value="<?php echo $settings->currency; ?>"> 
            <!-- <input type="image" src="images/bn.png" border="0" name="submit"> --> 
            <?php echo '<input type="submit" class="btn_new" value="'.$datavideo->video_buy_button->$j.' for '.$sym. trim($datavideo->price->$j).'">'; ?> 
           </form> 
          </div> 
          <div class="clear"></div> 
         </div> 

        <? 
        } 
       } 
      } 
      ?> 
     </div> 
    </div> 
<?php } ?> 
<!-- Products --> 
<?php if (1==2 && isset($dataproduct->product_enable) && $dataproduct->product_enable == 1){ ?> 
<div class="what-we-do container"> 
    <div class="row"> 
     <?php 

for ($i = 1; $i < 5; $i++) { 

    for ($j = 1; $j <= $settings->total_products; $j++) { 
     if ($dataproduct->product_name->$j == $data->product->$i) 
     { 
      ?> 
      <div class="service span6 productbox"> 
       <p class="mg15"></p> 
       <div class="left span2"> 
        <div class="icon-awesome "> <img src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/admin/data/images/<?php echo $dataproduct->product_img->$j; ?>" style="max-width:150px;"> </div> 
       </div> 
       <div class="left span3 spleft"><h4><?php echo stripslashes($dataproduct->product_name->$j); ?></h4><p><?php echo stripslashes($dataproduct->product_desc->$j); ?></p> 
       <p></p>Price : <?php echo $sym . $dataproduct->price->$j; ?><br><p></p><p></p> 
        <form id="signup" action="<?php echo paypal_path; ?>" method="post"> 
         <input type="hidden" name="cmd" value="_cart"> 
         <input type="hidden" name="business" value="<?php echo $settings->paypal; ?>"> 
         <input type="hidden" name="lc" value="US"> 
         <input type="hidden" name="add" value="1"> 
         <input type="hidden" name="item_name" value="<?php echo stripslashes($dataproduct->product_name->$j); ?>"> 
         <input type="hidden" name="amount" value="<?php echo $dataproduct->price->$j; ?>"> 
         <input type="hidden" name="return" value="<?php echo $dataproduct->link->$j; ?>"> 
         <input type="hidden" name="currency_code" value="<?php echo $settings->currency; ?>"> 
         <!-- <input type="image" src="images/bn.png" border="0" name="submit"> --> 
         <?php echo $btn; ?> 
        </form> 
        </div> 
       <div class="clear"></div> 
      </div> 

      <? 
     } 
    } 
} 
     ?> 
    </div> 
</div> 
<?php } ?> 
<!-- SEO --> 
<?php if (isset($dataseo->seohome_enable) && $dataseo->seohome_enable == 1){ ?> 
<div class="presentation container"> 
    <h2><?php echo $dataseo->main_headline != '' ? stripslashes($dataseo->main_headline) : 'We are <span class="violet">SocialPiggy</span>, a viral marketing company.'; ?></h2> 
    <p><?php echo $dataseo->main_headline != '' ? stripslashes($dataseo->sub_headline) : 'We create viral buzz around the internet...'; ?></p> 
</div> 
<div class="what-we-do container"> 
    <div class="row"> 
<?php 

for ($t = 1; $t < 5; $t++) { 

    for ($j = 0; $j < count($allDataSEO); $j++) { 
     if ($allDataSEO[$j]["name"] == $data->seoservice->$t) 
     { 
      ?> 
     <div class="service span3"> 
      <div class="icon-awesome"><img src="images/<?php echo $allDataSEO[$j]["image"]; ?>"></div> 
      <h4><?php echo $allDataSEO[$j]["title"]; ?></h4> 
      <p></p> 
      <form id="signup" action="<?php echo paypal_path; ?>" method="post"> 
       <input type="hidden" name="item_name" value="<?php echo $allDataSEO[$j]["title"]; ?>"> 

       <?php echo $fixed_str; ?> 
       <input type="hidden" name="on0" value="Selected value "> 
       <?php 
        for($tmp = 1; $tmp <= count((array)$dataseo->$allDataSEO[$j]["name"]); $tmp++) { 
         echo '<input type="hidden" name="option_select'.$tmp.'" value="'.filter_var($dataseo->$allDataSEO[$j]["name"]->$tmp, FILTER_SANITIZE_NUMBER_INT).'">'; 
         echo '<input type="hidden" name="option_amount'.$tmp.'" value="'.$dataseo->$allDataSEO[$j]["price"]->$tmp.'">'; 
        } 
       ?> 
       <div class="styled-select"> 
        <select name="os0"> 
         <?php 
          $tmp = 1; 
          for($i = 1; $i <= count((array)$dataseo->$allDataSEO[$j]["name"]); $i++) { 
           echo '<option value="'. filter_var($dataseo->$allDataSEO[$j]["name"]->$i, FILTER_SANITIZE_NUMBER_INT).'">'.$dataseo->$allDataSEO[$j]["name"]->$i.' - '.$sym.$dataseo->$allDataSEO[$j]["price"]->$i.'</option>'; 
           $tmp++; 
          } 
         ?> 
        </select> 
       </div> 
       <input type="hidden" name="return" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/thankyou.php'; ?>"> 
       <input type="hidden" name="on1" value="SiteURL:"> Enter URL 
       <input class="tb7" type="text" name="os1" id="TwitterRetweet" maxlength="200"> 
       <input type="hidden" name="currency_code" value="<?php echo $settings->currency; ?>"><br> 
       <center><!-- <input type="image" src="images/bn.png" border="0" name="submit"> --> <?php echo $btn; ?></center> 
      </form> 
      <p></p> 
     </div> 
     <? 
     } 
    } 
} 
?> 
    </div> 
</div> 
    <?php } ?> 
<?php if (isset($datasm->smhome_enable) && $datasm->smhome_enable == 1){ ?> 
<!-- Social Media --> 
<div class="presentation container"> 
    <h2><?php echo $datasm->main_headline != '' ? stripslashes($datasm->main_headline) : 'We are <span class="violet">SocialPiggy</span>, a viral marketing company.'; ?></h2> 
    <p><?php echo $datasm->main_headline != '' ? stripslashes($datasm->sub_headline) : 'We create viral buzz around the internet...'; ?></p> 
</div> 
    <div class="what-we-do container"> 
     <div class="row"> 
      <?php 

      for ($t = 1; $t < 5; $t++) { 

       for ($j = 0; $j < count($allDataSM); $j++) { 
        if ($allDataSM[$j]["name"] == $data->smservice->$t) 
        { 
         ?> 
         <div class="service span3"> 
          <div class="icon-awesome"><img src="images/<?php echo $allDataSM[$j]["image"]; ?>"></div> 
          <h4><?php echo $allDataSM[$j]["title"]; ?></h4> 
          <p></p> 
          <form id="signup" action="<?php echo paypal_path; ?>" method="post"> 
           <input type="hidden" name="item_name" value="<?php echo $allDataSM[$j]["title"]; ?>"> 

           <?php echo $fixed_str; ?> 
           <input type="hidden" name="on0" value="Selected value " /> 
           <?php 
           for($tmp = 1; $tmp <= count((array)$datasm->$allDataSM[$j]["name"]); $tmp++) { 
            echo '<input type="hidden" name="option_select'.$tmp.'" value="'.filter_var($datasm->$allDataSM[$j]["name"]->$tmp, FILTER_SANITIZE_NUMBER_INT).'">'; 
            echo '<input type="hidden" name="option_amount'.$tmp.'" value="'.$datasm->$allDataSM[$j]["price"]->$tmp.'">'; 
           } 
           ?> 
           <div class="styled-select"> 
            <select name="os0"> 
             <?php 
             $tmp = 1; 
             for($i = 1; $i <= count((array)$datasm->$allDataSM[$j]["name"]); $i++) { 
              echo '<option value="'. filter_var($datasm->$allDataSM[$j]["name"]->$i, FILTER_SANITIZE_NUMBER_INT).'">'.$datasm->$allDataSM[$j]["name"]->$i.' - '.$sym.$datasm->$allDataSM[$j]["price"]->$i.'</option>'; 
              $tmp++; 
             } 
             ?> 
            </select> 
           </div> 
           <input type="hidden" name="return" value="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/thankyou.php'; ?>"> 
           <input type="hidden" name="on1" value="SiteURL:"> Enter URL 
           <input class="tb7" type="text" name="os1" id="TwitterRetweet" maxlength="200"> 
           <input type="hidden" name="currency_code" value="<?php echo $settings->currency; ?>"><br> 
           <center><!-- <input type="image" src="images/bn.png" border="0" name="submit"> --> <?php echo $btn; ?></center> 
          </form> 
          <p></p> 
         </div> 
        <? 
        } 
       } 
      } 
      ?> 
     </div> 
    </div> 
<?php } ?> 
<!-- Latest Work --> 

<?php if ($settings->total_testi > 0) { ?> 
    <!-- Testimonials --> 
    <div class="testimonials container"> 
     <div class="testimonials-title"> 
      <h3>Testimonials</h3> 
     </div> 
     <div class="row"> 
      <div class="tab-content"> 
       <?php 
        for($i = 1; $i <= $settings->total_testi; $i++) { 
         echo ' 
          <div class="testimonial-list"> 
           <img src="admin/data/images/'.$data->testi_img->$i.'" title="" alt=""> 
           <p>'.stripslashes($data->testi_msg->$i).'<br><span class="violet" style="color: '.$settings->dark_color.';">'.$data->testi_auth->$i.'</span></p> 
          </div> 
         '; 
        } 
       ?> 
      </div> 
     </div> 
    </div> 
<?php } ?> 
<style> 
.productbox div { 
    text-align: center; 
} 
    .what-we-do .service { border-bottom: 2px solid <?php echo $settings->dark_color; ?> } 
</style> 
<?php } 
include('includes/footer.php'); 

什麼可以是問題,它可能是固定的?

在此先感謝!

回答

0
Information that was incorrect was fixed in the code below if it still does not work then please give all the code to correctly see which line is actually throwing an error 


<div class="testimonials container"> 
      <div class="testimonials-title"> 
       <h3>Testimonials</h3> 
      </div> 
      <div class="row"> 
       <div class="tab-content"> 
        <?php 
         for($i = 1; $i <= $settings->total_testi; $i++) { 
          echo ' 
           <div class="testimonial-list"> 
            <img src="admin/data/images/'.$data->testi_img->$i.'" title="" alt=""> 
            <p>'.stripslashes($data->testi_msg->$i).'<br><span class="violet" style="color: '.$settings->dark_color.';">'.$data->testi_auth->$i.'</span></p> 
           </div> 
          '; 
         } 
        ?> 
       </div> 
      </div> 
     </div> 

了隨機<?php } ?>不知道這是關閉,但它並沒有放在給源。

<style> 
    .productbox div { 
     text-align: center; 
    } 
     .what-we-do .service { border-bottom: 2px solid <?php echo $settings->dark_color; ?> } 
    </style> 
    <?php 
    include('includes/footer.php'); 
    ?> 
+0

閉合/結束標記'>'不需要 - http://stackoverflow.com/questions/4410704/why-would-one-omit-the-close-tag或http://計算器.com/questions/19953483/php-end-tag – Sean

+0

謝謝你不知道會修復:) –

+0

感謝您關注@JacobWebb。我試了一下,但沒有奏效。另外,我很驚訝它如何在在線服務器上工作,但不在本地主機上工作。我會嘗試附上完整的文件! – Sheryl

相關問題