2014-08-29 76 views
-2

我保持越来越THT错误“解析错误:语法错误,在第13行意外的文件结尾”为我的代码...它下面解析错误:语法错误,在线路意外的文件结束13

<?php 

    $all= get_posts(array('post_type' => 'books', 'numberposts' => -1,)); 

    foreach ($all as $post) : setup_postdata($post); 

     if (!empty($post)) 
     { 
     $postid=$post->ID; 
     echo $postid; 
     } 

    ?> 
+0

你打开'foreach'但不要关闭它:(很多伤心 – ljacqu 2014-08-29 14:50:55

回答

5

你忘了结束您foreach

<?php 

$all= get_posts(array('post_type' => 'books', 'numberposts' => -1,)); 

foreach ($all as $post) : setup_postdata($post); 

    if (!empty($post)) 
    { 
    $postid=$post->ID; 
    echo $postid; 
    } 
endforeach; 
?> 
相关问题