{"id":1632,"date":"2014-12-28T16:59:37","date_gmt":"2014-12-28T08:59:37","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1632"},"modified":"2015-07-31T10:12:19","modified_gmt":"2015-07-31T02:12:19","slug":"php-short-open-tag","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/php\/php-short-open-tag.html","title":{"rendered":"PHP\u77ed\u6807\u7b7e\uff08short_open_tag ?>\uff09\uff0c\u8fd8\u662f\u5fd8\u4e86\u5b83\u5427"},"content":{"rendered":"
\u662f\u7684\uff0cPHP\u9ed8\u8ba4\u662f\u5f00\u542fPHP\u77ed\u6807\u7b7e\u7684\uff0c\u5373\u9ed8\u8ba4\u60c5\u51b5\u4e0bshort_open_tag=ON\uff0c\u5927\u5bb6\u770b\u770bPHP\u7684\u5b98\u65b9\u8bf4\u660e\u4e0a\u9762\u8bb2\u7684\u5f88\u6e05\u695a\u4e0b\u9762\u7684\u5b98\u65b9\u914d\u7f6e\u6587\u4ef6\u4e0a\u9762\u4e5f\u662f\u8fd9\u6837\u8bf4\u7684\uff08\u7eff\u8272\u548c\u7ea2\u8272\u6807\uff09\u3002<\/p>\n
; This directive determines whether or not PHP will recognize code between<\/p>\n
; <? and ?> tags as PHP source which should be processed as such. It is<\/p>\n
; generally recommended that <?php and ?> should be used and that this feature<\/p>\n
; should be disabled, as enabling it may result in issues when generating XML<\/p>\n
; documents, however this remains supported for backward compatibility reasons.<\/p>\n
; Note that this directive does not control the <?= shorthand tag, which can be<\/span><\/p>\n
; used regardless of this directive.<\/span><\/p>\n
; Default Value: On<\/strong><\/span><\/p>\n
; Development Value: Off<\/span><\/p>\n
; Production Value: Off<\/span><\/p>\n
; http:\/\/php.net\/short-open-tag<\/p>\n
short_open_tag = Off<\/p><\/blockquote>\n
\u4e0d\u8fc7\u5728\u8fd9\u91cc\u6211\u8fd8\u662f\u5efa\u8bae\u5927\u5bb6\u8fd8\u662f\u5fd8\u4e86\u8fd9\u4e2a\u9ed8\u8ba4\u8bbe\u7f6e\u5427\uff0c\u6700\u597d\u8fd8\u662f\u4e0d\u8981\u4f7f\u7528\u77ed\u6807\u7b7e\u7684\u597d\u3002<\/p>\n
\u5927\u5bb6\u5982\u679c\u5728Linux\u4e0b\u7f16\u8f91\u5b89\u88c5PHP\u7684\u65f6\u5019\u4e00\u5b9a\u4f1a\u53d1\u73b0\uff0c\u5728\u6e90\u6587\u4ef6\u6839\u76ee\u5f55\u4e0b\u9762\u6709\u4e24\u4e2a\u5efa\u8bae\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n
php.ini-development<\/p>\n
php.ini-production<\/p>\n
\u5373\u5f00\u53d1\u73af\u5883\u63a8\u8350\u914d\u7f6e\u548c\u751f\u4ea7\u73af\u5883\u4e0b\u63a8\u8350\u914d\u7f6e\uff0c\u8fd9\u4e24\u4e2a\u6587\u4ef6\u662f\u5b98\u65b9\u63a8\u8350\u914d\u7f6e\uff0c\u57fa\u672c\u4e0a\u5927\u5bb6\u6839\u636e\u4f7f\u7528\u60c5\u51b5\u91c7\u7528\u8fd9\u4e24\u4e2a\u6587\u4ef6\u4f5c\u4e3a\u81ea\u5df1\u7684php.ini\u6587\u4ef6\u5e94\u8be5\u80fd\u5e94\u4ed8\u9700\u6c42\uff0c\u76f8\u4fe1\u4e0d\u5728\u5c11\u6570\u540c\u5b66\u4e5f\u662f\u8fd9\u4e48\u505a\u4e86\u3002\u4f46\u662f\u518d\u770b\u770b\u4e0a\u9762\u5b98\u65b9\u914d\u7f6e\u6587\u4ef6\u622a\u53d6\u90e8\u5206\u5373\u7ea2\u8272\u6807\u90e8\u5206\uff0c\u5927\u5bb6\u5e94\u8be5\u53ef\u4ee5\u770b\u5230\uff0c\u5b9e\u9645\u4e0a\u8fd9\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6\u9ed8\u8ba4\u662f\u5173\u95ed\u77ed\u6807\u7b7e\u914d\u7f6e\u9879\u7684\uff0c\u4e5f\u5c31\u662f\u5982\u679c\u5927\u5bb6\u4f7f\u7528\u8fd9\u4e24\u4e2a\u63a8\u8350\u914d\u7f6e\u7684\u8bdd\uff0c\u540c\u65f6\u6ca1\u6709\u7279\u522b\u5bf9 short_open_tag \u505a\u914d\u7f6e\u4fee\u6539\u7684\u8bdd\uff0c\u90a3\u4e48\u5b9e\u9645\u4e0a\u9ed8\u8ba4\u4f60\u7684PHP\u8fd0\u884c\u73af\u5883\u662f\u4e0d\u652f\u6301\u77ed\u6807\u7b7e\u7684\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u6211\u5199\u8fd9\u7bc7\u6587\u7ae0\u7684\u539f\u56e0\u3002\u5927\u5bb6\u8fd8\u662f\u653e\u5f03PHP\u77ed\u6807\u7b7e\u5427\uff0c\u5b9e\u9645\u4e0a\u5373\u4fbf\u4f60\u5f00\u542f\u4e86\u77ed\u6807\u7b7e\uff0c\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\u8fd8\u662f\u4e0d\u5f97\u4e0d\u5173\u95ed\u5b83\uff0c\u6bd4\u5982\u5728\u548cXML\u6587\u4ef6\u914d\u5408\u4f7f\u7528\u7684\u65f6\u5019<\/p>\n
<? echo '<?xml version=\"1.0\"'; ?><\/code><\/p>\n
\u591a\u4e48\u7cdf\u7cd5\u7684\u9886\u609f?!<\/p>\n
\u5176\u5b9e\u50cf\u8fd9\u6837\u7684\u60c5\u51b5\u8fd8\u6709\u5f88\u591a\uff0c\u6bd4\u5982\u4f60\u6240\u8fd0\u884c\u7684\u73af\u5883\u786e\u5b9e\u662f\u5173\u95ed\u4e86\u77ed\u6807\u7b7e\uff0c\u800c\u4f60\u53c8\u65e0\u6cd5\u6216\u5f88\u56f0\u96be\u53bb\u4fee\u6539short_open_tag\u914d\u7f6e\u7684\u65f6\u5019<\/p>\n
\u6240\u4ee5\u6211\u5efa\u8bae\u8fd8\u662f\u653e\u5f03\u8fd9\u4e2a\u300e\u5feb\u6377\u65b9\u5f0f\u300f\u5427\uff0c\u4f55\u5fc5\u7559\u6b64\u9690\u60a3\uff0c\u4f60\u8bf4\u5462\uff1f<\/p>\n
\u5f53\u7136\u4e0d\u5f97\u4e0d\u591a\u8bf4\u4e00\u53e5\uff0c\u4ed4\u7ec6\u770b\u4e00\u770b\u5b98\u65b9\u6587\u6863\u4f60\u4f1a\u53d1\u73b0\uff0c\u770b\u4e0a\u9762\u9ec4\u8272\u6807\u3002\u6709\u4e00\u79cd\u4f7f\u7528\u5f62\u5f0f\uff0c\u5373<\/p>\n
<?=<\/code>\uff0c\u5b83\u548c\u00a0
<? echo<\/code>\u00a0\u7b49\u4ef7\uff0c \u4ece PHP 5.4.0 \u8d77\uff0c\u00a0
<?=<\/code>\u00a0\u603b\u662f\u53ef\u7528\u7684\u3002<\/p>\n
\u53c2\u8003\u8d44\u6599<\/p>\n