PHP short_open_tag 設定

在我打開一個專案時,PHP原始碼被瀏覽去輸出了,原來是之前的寫法是以 <? ?> 這個開頭,我的環境不支援此種寫法,所以要到php.ini的 short_open_tag=Off 改成 On 就可以了。

; 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  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  ; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag=On // 本來是Off,改成On

最後更新:2021-12-21