PHP短标签(short_open_tag ?>),还是忘了它吧
2014年12月28日
没有评论
是的,PHP默认是开启PHP短标签的,即默认情况下short_open_tag=ON,大家看看PHP的官方说明上面讲的很清楚下面的官方配置文件上面也是这样说的(绿色和红色标)。
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
不过在这里我还是建议大家还是忘了这个默认设置吧,最好还是不要使用短标签的好。