maidongdong
1.  <?php echo \'if you want to serve XHTML or XML documents, do it like this\'?>

2.  <script language="php">
        echo \'some editors (like FrontPage) don\\'t
              like processing instructions\';
    </script>

3.  <? echo \'this is the simplest, an SGML processing instruction\'?>
    <?= expression ?> This is a shortcut for "<? echo expression ?>"

4.  <% echo \'You may optionally use ASP-style tags\'; %>
    <%= $variable; # This is a shortcut for "<% echo . . ." %>

上例中的 1 和 2 中使用的标记总是可用的,其中示例 1 中是最常用,并建议使用的。

短标记(上例 3)仅在通过 php.ini 配置文件中的指令 short_open_tag 打开后才可用,或者在 PHP 编译时加入了 --enable-short-tags 选项。

ASP 风格标记(上例 4)仅在通过 php.ini 配置文件中的指令 asp_tags 打开后才可用。

分类:

技术点:

相关文章: