.xml 文件中的 PHP 错误? [英] PHP error in .xml file?
本文介绍了.xml 文件中的 PHP 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,首先,我将此行添加到我的 .htaccess 文件中,以便 php 引擎解析 .xml 文件中的 php 代码:
OK firstly, I added this line to my .htaccess file so the php engine parses php code in .xml file:
AddType application/x-httpd-php .php .php3 .phtml .html .xml
之后,当我查看 .xml 文件时,我收到此 PHP 错误:
After that when I view an .xml file I get this PHP error:
解析错误:解析错误,第 1 行/var/www/vhosts/mydomain.com/httpdocs/test.xml 中的意外 T_STRING
但是第 1 行甚至不是 php 实际上这是第 1 行:
But line 1 is not even php infact this is line 1:
<?xml version="1.0" encoding="utf-8"?>
谁能告诉我这是什么问题?
Can anyone tell me what the problem is?
谢谢.
推荐答案
那是因为 是 php 的简短开始标签.
That's because <?
is the short opening tag for php.
试试<?php echo '<?xml version="1.0" encoding="utf-8"?>';?>
这篇关于.xml 文件中的 PHP 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文