这个问题在这里已有答案:
我收到错误500,在查看我的错误日志时出现此错误:
PHP解析错误:语法错误,第90行/var/www/site/site.com.au/wp-content/themes/site/page.php中的意外'endwhile'(T_ENDWHILE)
第90行是此代码中的结尾:
<? while ( $query->have_posts() && $count != 3) : $query->the_post()?>
<? $count++; ?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<?php the_post_thumbnail('medium'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 post-info">
<h3><a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
<time><?php the_date(); ?></time>
<div class="category">
<!-- <p>Category: <a title="Posts about <?php get_category_link(get_the_category()[0]->title); ?>" href="<?php echo get_category_link(get_the_category()[0]->id); ?>"><?php the_category(', ', 'single', get_the_ID()); ?></a></p>-->
</div>
<a title="<?php echo get_the_title(); ?>" href="<?php echo get_permalink(); ?>" class="col-12 btn btn-block btn-info">Read More..</a>
</div>
</div>
<?php
endwhile; //resetting the page loop
wp_reset_query(); //resetting the page query
?>
从WordPress 4.7.10迁移到最新的WP(我认为4.9)后,为什么会出现此错误?
我目前正在新环境中使用PHP 7 .
1 回答
看起来问题是你在这里使用shorttags:
<?
而不是<?php
如果您的服务器没有将它们解释为PHP,那么php会在看到close标签之前看到它们 . 将它们更改为
<?php
而不是<?
.