Home >Backend Development >PHP Tutorial >php配置打开余标签

php配置打开余标签

WBOY
WBOYOriginal
2016-06-13 12:21:271007browse

php配置打开短标签

虽然php提倡标准的写法:

<code class=" hljs xml"><span class="php"><span class="hljs-preprocessor"><?php</span> ></span></code>

但是在和一些系统对接的时候可能对方使用的是非标准的写法:

<code class=" hljs xml"><span class="php"><span class="hljs-preprocessor"><?</span> <span class="hljs-preprocessor">?></span></span></code>

对接还是要进行,我们运行对方的代码会报错,需要配置本地的环境支持短标签的写法,配置方法:
修改php.inishort_open_tag 为开启状态

<code class=" hljs ini"><span class="hljs-setting">short_open_tag = <span class="hljs-value"><span class="hljs-keyword">On</span></span></span></code>

Tips:对xampp,php.ini中会有2个short_open_tag,经测试真正起作用的是xampp下的,即是下面的配置短标签是Off的

<code class=" hljs ini"><span class="hljs-comment">; http://php.net/short-open-tag</span><span class="hljs-setting">short_open_tag=<span class="hljs-value"><span class="hljs-keyword">On</span></span></span><span class="hljs-comment">; XAMPP for Linux is currently old fashioned</span><span class="hljs-setting">short_open_tag = <span class="hljs-value"><span class="hljs-keyword">Off</span></span></span></code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn