<p><span style="color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; text-indent: 26px; ">天缘昨天使用xampp进行PHP测试,突然发现PHP不执行了,全是源码输出,后来检查发现,是短标签的问题,因为天缘的习惯一直都是写成<?php and ?>这样的完整形式,但是写成短标签(Short tag)就不可以了,打开PHP.INI文件才知道,原来最新版本的xampp已经默认把短标签只识别支持默认关闭掉了。只需要打开即可。</span></p><p><span style="color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; text-indent: 26px; "><br /></span></p><p><span style="color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; text-indent: 26px; "></span><h3 style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; text-indent: 25px; font-size: 18px; font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; line-height: 23px; text-align: left; ">问题现象:</h3></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 6px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 2em; color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; "><?php echo "123"; ?>可以执行,<? echo "123"; ?>却直接输出源码。</p><h3 style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; text-indent: 25px; font-size: 18px; font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; line-height: 23px; text-align: left; ">解决办法:</h3><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 6px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 2em; color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; ">在PHP.INI文件中,查找<?或short_open_tag,有下面信息提示,意思是是否打开短标签识别,而且已经推荐大家使用完整封堵标签<?php and ?>,尽量不要使用短标签<? and ?>。</p><p><span style="color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; text-indent: 26px; "></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 6px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 2em; color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; ">; http://php.net/short-open-tag<br />short_open_tag = Off<br /><br />; Allow ASP-style <% %> tags.<br />; http://php.net/asp-tags<br />asp_tags = Off</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 6px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-indent: 2em; color: rgb(43, 43, 43); font-family: 'Microsoft YaHei', Verdana, Tahoma, Arial, SimSun; font-size: 13px; line-height: 23px; text-align: left; ">把以上设置short_open_tag = Off改成short_open_tag = On即可,当然asp_tags如果是On要改成Off关闭。</p><br />