dqz30992 2014-05-29 01:08
浏览 34
已采纳

PHP的差异行为显示xml

This is my php code.

[xmltest.php]

<?xml version="1.0" encoding="UTF-8"?>
<results>
  <date>test data</date>
</results>

When I run it in tow servers each results are different.

Results in browser from server1 and server2 are here.

[server1]

<?xml version="1.0" encoding="UTF-8"?>
-<results>
<date>test data</date>
 </results>

[server2]

Parse error: syntax error, unexpected T_STRING in /opt/apache-httpd-2.2.22/htdocs_demo/xmltest.php on line 1

I want to fix the problem in server2.

Which settings do I have to check?

Server1 is Windows7(64bit)+Apache2.2.17(32bit)+PHP5.3.14(32bit)

Server2 is CentOS6.4(64bit)+Apache2.2.22(64bit)+PHP5.3.14(64bit)

  • 写回答

1条回答 默认 最新

  • dongpu3792 2014-05-29 01:16
    关注

    Your “second server” has short_open_tag enabled, which makes it think <? opens a PHP block, and after that it finds xml, which is not a valid PHP expression.

    Either disable it, or output <?xml via PHP in the first place to avoid this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办