【问题标题】:Parse error: syntax error, unexpected end of file in woocommerce.php on line 56 [duplicate]解析错误:语法错误,woocommerce.php 中第 56 行的文件意外结束 [重复]
【发布时间】:2013-12-09 20:19:35
【问题描述】:

您好,当我尝试在 woocommerce 中查看我的产品时,我收到此错误消息 Parse error: syntax error, unexpected end of file in woocommerce.php on line 56。这是该文件的代码。第 56 行是最后一行。

">
<div class="container" role="main">
    <div class="row">

        <?php do_action( '__before_article_container'); ##hook of left sidebar?>

            <div id="content" class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container">

                <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?>

                    <?php if ( tc__f('__is_no_results') || is_404() ) : ##no search results or 404 cases ?>

                        <article <?php tc__f('__article_selectors') ?>>
                            <?php do_action( '__loop' ); ?>
                        </article>

                    <?php endif; ?>

                    <?php if ( have_posts() && !is_404() ) : ?>
                        <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
                            <?php the_post(); ?>

                            <?php do_action ('__before_article') ?>
                                <article <?php tc__f('__article_selectors') ?>>
                                    <?php do_action( '__loop' ); ?>
                                </article>
                            <?php do_action ('__after_article') ?>

                        <?php endwhile; ?>

                   <?php woocommerce_content(); ?>

                <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?>

            </div><!--.article-container -->

       <?php do_action( '__after_article_container'); ##hook of left sidebar?>

    </div><!--.row -->
</div><!-- .container role: main -->

<?php do_action( '__after_main_container' ); ?>

【问题讨论】:

    标签: php wordpress woocommerce


    【解决方案1】:

    这个的endif在哪里:

    <?php if ( have_posts() && !is_404() ) : ?>
    

    【讨论】:

      【解决方案2】:

      你有未闭合的 IF 语句:

      <?php if ( have_posts() && !is_404() ) : ?>
      

      尝试添加或删除 : 符号,如果你只想在 next while 中使用它

      【讨论】:

        【解决方案3】:

        这是无错误代码,您没有关闭if 语句

        <div class="container" role="main">
            <div class="row">
        
                <?php do_action( '__before_article_container'); ##hook of left sidebar?>
        
                <div id="content"
                    class="<?php echo tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'class' ) ?> article-container">
        
                    <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?>
        
                    <?php if ( tc__f('__is_no_results') || is_404() ) : ##no search results or 404 cases ?>
        
                    <article <?php tc__f('__article_selectors') ?>>
                        <?php do_action( '__loop' ); ?>
                    </article>
        
                    <?php endif; ?>
        
                    <?php if ( have_posts() && !is_404() ) : ?>
                    <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
                    <?php the_post(); ?>
        
                    <?php do_action ('__before_article') ?>
                    <article <?php tc__f('__article_selectors') ?>>
                        <?php do_action( '__loop' ); ?>
                    </article>
                    <?php do_action ('__after_article') ?>
        
                    <?php endwhile; ?>
                    <?php endif; ?>
                    <?php woocommerce_content(); ?>
        
                    <?php do_action ('__after_loop');##hook of the comments and the posts navigation with priorities 10 and 20 ?>
        
                </div>
                <!--.article-container -->
        
                <?php do_action( '__after_article_container'); ##hook of left sidebar?>
        
            </div>
            <!--.row -->
        </div>
        <!-- .container role: main -->
        
        <?php do_action( '__after_main_container' ); ?>
        

        【讨论】:

        • 反对 a) 在发布一个多小时后盗取答案,b) 从字面上为他们编写某人的代码而不是教他们。如果你想为人们编写代码,那就找份工作。这个网站是为了帮助人们学习,而不是为他们做事。
        • 在投反对票之前,您是否还阅读了答案中的“您没有关闭if 声明”
        猜你喜欢
        • 1970-01-01
        • 2013-07-12
        • 2018-01-02
        • 2017-06-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多