Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 分析错误:语法错误,XAMPP服务器上的文件意外结束_Php - Fatal编程技术网

Php 分析错误:语法错误,XAMPP服务器上的文件意外结束

Php 分析错误:语法错误,XAMPP服务器上的文件意外结束,php,Php,我在本地主机(XAMPP)和在线服务器上设置了一个PHP网站。在本地主机上,当我尝试运行网站时,出现以下错误: 分析错误:语法错误,第304行C:\XAMPP\htdocs\website\index.php中的文件意外结束 然而,同样的代码在在线服务器上运行良好 下面是它的外观: <?php $file = "admin/data/home.txt"; $fileproduct = "admin/data/product.txt"; $fileseo = "admin/data/seoh

我在本地主机(XAMPP)和在线服务器上设置了一个PHP网站。在本地主机上,当我尝试运行网站时,出现以下错误:

分析错误:语法错误,第304行C:\XAMPP\htdocs\website\index.php中的文件意外结束

然而,同样的代码在在线服务器上运行良好

下面是它的外观:

<?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');

下面的代码中修复了不正确的信息,如果它仍然不起作用,请给出所有代码以正确查看哪一行实际抛出错误
推荐书
下面的代码中修复了不正确的信息,如果它仍然不起作用,请给出所有代码以正确查看哪一行实际抛出错误
推荐书

结束/结束标记
?>
不是必需的-或者感谢您不知道这会解决:)感谢您查看此@JacobWebb。我试过了,但没有成功。另外,我很惊讶它是如何在在线服务器上工作的,而不是在本地主机上。我将尝试附加完整的文件@JacobWebb我添加了完整的代码,请看是否可以帮助@Sheryl所以看着你的代码,我注意到你使用了“确定以无?>结束文件是好的,但以结束/结束标记开始块是不需要的”
?>
,或者感谢你不知道这会解决:)感谢你查看这个@JacobWebb。我试过了,但没有成功。另外,我很惊讶它是如何在在线服务器上工作的,而不是在本地主机上。我将尝试附加完整的文件@JacobWebb我添加了完整的代码,请看是否可以帮助@Sheryl所以看着你的代码,我注意到你使用了“确定以no结尾文件没有问题?>但以
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>
<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');
    ?>