php – 语法错误,意外’endforeach’
发布时间:2020-12-13 21:49:23 所属栏目:PHP教程 来源:网络整理
导读:我似乎无法找到语法错??误.这是有问题的代码: div class='related_row' ?php foreach($postList as $post): setup_postdata( $post ); ? div class='related_product' ?php if(has_post_thumbnail() ) : ? div class='related_image' a class='service_over
我似乎无法找到语法错??误.这是有问题的代码:
<div class='related_row'> <?php foreach($postList as $post): setup_postdata( $post ); ?> <div class='related_product'> <?php if(has_post_thumbnail() ) : ?> <div class='related_image'> <a class='service_overlay' href='<?php the_permalink(); ?>'></a> <a class='service_page' href='<?php the_permalink(); ?>'><?php the_post_thumbnail(); ?></a> </div> <?php else: ?> <div class='related_image'> <a class='service_overlay' href='<?php the_permalink(); ?>'></a> <a class='service_page' href='<?php the_permalink(); ?>'><img src="<?php get_bloginfo() ?>/wp-content/uploads/2013/08/header_image.png" alt='Service image' /></a> </div> <?php endif; ?> <div class='related_title'> <a href='<?php the_permalink(); ?>'><?php the_title(); ?></a> </div> </div> <?php $counter++; ?> <?php if($counter % 3 == 0 && $counter < $total ): ?> </div> <div class='related_row'> <? endif; ?> <?php endforeach; wp_reset_postdata(); ?> </div> 在过去的20分钟里,我一直在盯着这段代码,似乎无法发现它.如果有人能指出来,我真的很感激. 解决方法
如果您没有打开“短标签”,则错误发生在上面示例的第26行:
<? endif; ?> 应该 <?php endif; ?> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |