标签:
准备做个wordpress的主题,结果看到了如下的语法:<div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php if ( have_posts() ) : ?> <?php if ( is_home() && ! is_front_page() ) : ?> <header> <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1> </header> <?php endif; ?> <?php // Start the loop. while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); // End the loop. endwhile; // Previous/next page navigation. the_posts_pagination( array( 'prev_text' => __( 'Previous page', 'twentyfifteen' ), 'next_text' => __( 'Next page', 'twentyfifteen' ), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', ) ); // If no content, include the "No posts found" template. else : get_template_part( 'content', 'none' ); endif; ?> </main><!-- .site-main --> </div><!-- .content-area -->
这才知道php是有不太常用的替代语法的: 据 http://www.jb51.net/article/23252.htm
PHP中那些语法有替代语法?
流程控制(包括if,while,forforeach,switch)这几个语句有替代语法。
替代语法的基本形式:
左花括号({)换成冒号(:),把右花括号(})分别换成 endif;,endwhile;,endfor;,endforeach; 以及 endswitch;
举个例子吧:
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/recordme/article/details/46842009