xml version 1.0 encoding utf
xml version 1.0 encoding utf-8 in php, I have tried :
echo '<?xml version="1.0" encoding="utf-8"?>';
but this doesnt validate on w3c, when using it in xhtml, the php shows an error.
Whats the easiest way to fix this? With it validating
Thanks
error on w3c:
Line 5, Column 46: character "'" not allowed in prolog
echo '<?xml version="1.0" encoding="utf-8"?>';
Line 5, Column 45: XML Parsing Error: Start tag expected, '<' not found
echo '<?xml version="1.0" encoding="utf-8"?>';
php error:
Parse error: syntax error, unexpected T_STRING in /home/public_html//request.php on line 7
<?php
session_start();
include ('../connection.php');
include ('../functions.php');
echo "<?xml version="1.0" encoding="UTF-8"?>";
?>
问题是你的php.ini中的short_open_tag = On
I'm inclined to agree w/ @just that this is likely to do with short_open_tag = On
. Here are a few ways to fix this.
You could break the tag into pieces (short, sweet, and easy, but it has to be done for every instance):
echo '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
You could modify the php.ini
directly (permanent and holistic, the best solution in my opinion but it requires modifo get IIS ication of php.ini
and restart of Apache).
Or, you could use htaccess to define the ini setting for you. This gets around of the issues most of the issues w/ 1 & 2, but it requires Apache (I have no idea how to get IIS to make this work)
你在脚本的开头加入了<?php
标签吗?
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
链接地址: http://www.djcxy.com/p/69682.html
上一篇: 带有RFDa和XHTML 1.0 Transitional支持的DTD
下一篇: xml版本1.0编码utf