簡體   English   中英

解析錯誤:語法錯誤,意外的$ end-第91行

[英]Parse error: syntax error, unexpected $end - line 91

我搜索了答案,發現缺少引號或方括號會導致該錯誤。 我已經檢查了幾次並添加了缺失的引號,但第91行在底部,因此除非它是“ else: ”,否則我無法弄清楚,我從上到下看了一下,但我不確定這可能導致錯誤。 請借給我你的眼睛來發現問題。 謝謝

<?php

if( ereg( '/[a-z-]+/[a-z]/$', $_SERVER['REQUEST_URI'])) {

$url_array = explode('/', $_SERVER['REQUEST_URI']); 
$alpha = $url_array[sizeof($url_array)-2];

$postids = $wpdb->get_col("
    SELECT p.ID
    FROM $wpdb->posts p
    WHERE p.post_title REGEXP '^" . $wpdb->escape($alpha) . "'
    AND p.post_status = 'publish' 
    AND p.post_type = 'book'
    AND p.post_date < NOW()
    ORDER BY p.post_title ASC"
);


if ($postids) {
  $args=array(
    'post__in' => $postids,
    'post_type' => 'list', 
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
  );
  $my_query = null;
  $my_query = new WP_Query($args);
  if( $my_query->have_posts() ) {

    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    <div class="listing">

       <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
        <?php the_excerpt(); ?>             
    </div>

      <?php
    endwhile;
    }

  }

}
 else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

     ?>          

    <div class="listing">
     <h3><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h3>
    <?php the_excerpt(); ?>             
    </div>

    <?php endwhile; else:?>

    <p>Sorry, no profiles matched your criteria.</p>

   <?php  endif; ?>
</div>

<?php get_sidebar(); ?>

</div>
<?php get_footer(); ?>
 ...
  else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

     ?>          

您還沒有結束其他事情{將會拋出該錯誤。

更改為:

else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

 ?>          

<div class="listing">
 <h3><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h3>
<?php the_excerpt(); ?>             
</div>

<?php endwhile; else:?>

<p>Sorry, no profiles matched your criteria.</p>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM