解析错误:语法错误,意外的文件结束 - PHP 5

时间:2013-02-08 03:59:28

标签: wordpress parsing syntax

我调试了我的索引文件并过滤掉了我的代码。事实证明,如果我使用以下代码,该站点将返回“意外的文件结束”错误。如果我删除它,该网站显示没有错误。所以我不确定我是否缺少任何语法代码或是否存在拼写错误。

 <?php

 // The Query
 query_posts( 'cat=9614&posts_per_page=5&tag=review' );

 // The Loop
 while ( have_posts() ) : the_post();
 ?>
 <li>
 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
 </li>
 <?
 endwhile;

 // Reset Query
 wp_reset_query();

 ?>

1 个答案:

答案 0 :(得分:6)

使用<?php代替<?

<?php

 // The Query
 query_posts( 'cat=9614&posts_per_page=5&tag=review' );

 // The Loop
 while ( have_posts() ) : the_post();
 ?>
 <li>
 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
 </li>
 <?php // error is here
 endwhile;

 // Reset Query
 wp_reset_query();

 ?>