Php 如何回音<;?xml版本=";1.0“;编码=";utf-8“&燃气轮机;在一页中?
我使用脚本以XML显示页面,但我需要在开始时显示它,但每当我尝试时,它就会破坏代码 以下是我尝试的代码:Php 如何回音<;?xml版本=";1.0“;编码=";utf-8“&燃气轮机;在一页中?,php,xml,encoding,utf-8,Php,Xml,Encoding,Utf 8,我使用脚本以XML显示页面,但我需要在开始时显示它,但每当我尝试时,它就会破坏代码 以下是我尝试的代码: <?php header('Content-Type: application/xml'); $output = " <?xml version='1.0' encoding='utf-8' ?> "; print ($output); ?> 但它不起作用,有什么帮助吗?使用echo 是的,使用echo,但您不需要额外的变量,您可以使用不带反斜杠的单引号字
<?php
header('Content-Type: application/xml');
$output = "
<?xml version='1.0' encoding='utf-8' ?>
";
print ($output);
?>
但它不起作用,有什么帮助吗?使用echo
是的,使用echo,但您不需要额外的变量,您可以使用不带反斜杠的单引号字符串
<?php
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?' . ">\n"; //connate strings to protect end of php formatting in simple editors, and use new line tag
?>
<?php
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?' . ">\n"; //connate strings to protect end of php formatting in simple editors, and use new line tag
?>