wordpress里语法.这里面的:号是什么意思呢?<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>新手学习中.

解决方案 »

  1.   

    if(true): echo 2;endif;//老式的写法,用在模版语法中,可避免{}(大括号)解析问题
    等价于
    if(true)
    {
      echo 2;
    }
      

  2.   

    1、if..endif 语法
    if ($foo):
        echo "yep\n";
    elseif ($bar):
        echo "almost\n";
    else:
        echo "nope\n";
    endif; 
    2、while..endwhile 语法
    while ($more_to_come):
        ...
    endwhile; 
      

  3.   


    也不是少见,我看过一些PHP产品都喜欢用它,就是为了方便