【问题标题】:What's the difference in using <?php ... ?> and <? ... ?> [duplicate]使用 <?php ... ?> 和 <? 有什么区别? ... ?> [重复]
【发布时间】:2012-04-09 18:01:55
【问题描述】:

可能重复:
What is the difference between the PHP open tags “<?=” and “<?php”/“<?”?

使用时有什么不同吗

<?php
    something;
    something2;
?>

<?
    something;
    something2;
?>

我看到的所有地方都使用&lt;?php ... ?&gt;。有什么优势吗?

【问题讨论】:

    标签: php


    【解决方案1】:

    不要使用&lt;? ... ?&gt;,你永远不会有问题。

    谷歌php shorthand

    【讨论】:

      【解决方案2】:

      &lt;? 要求在服务器上启用短标签。它与其他一些指令(例如&lt;?xml)冲突。

      【讨论】:

        【解决方案3】:

        第二个选项仅在启用short_open_tag 时有效。

        此外,如果启用,则不能在 XML 中使用 php,其中有时会使用 &lt;?xml ...&gt;

        【讨论】:

          猜你喜欢
          • 2011-09-13
          • 1970-01-01
          • 2010-11-27
          • 2014-05-16
          • 2017-02-17
          • 2011-09-27
          • 2013-04-22
          • 2012-03-29
          • 1970-01-01
          相关资源
          最近更新 更多