Heim  >  Artikel  >  Backend-Entwicklung  >  PHP无法显示XML页解决办法

PHP无法显示XML页解决办法

WBOY
WBOYOriginal
2016-06-13 13:41:211136Durchsuche

PHP无法显示XML页

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php header('Content-Type: text/xml');
        echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
        echo '<response>';
        $name = $_POST['name'];
        echo 'hello '.htmlentities($name);
        echo '</response>';
    
?>



出错了。提示如下。

无法显示 XML 页。 
使用 XSL 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。 


--------------------------------------------

Prolog 外部不能有 DOCTYPE 声明。处理资源 'http://127.0.0.1:8088/test/test.php' 时出错。第 2 行,位置: 11 

...

------解决方案--------------------
你这段代码才8,9行,错误报的是第11行,我想八成是
PHP code
//这儿是否有HTML?有输出?
<?php header('Content-Type: text/xml');
<br /><font color="#e78608">------解决方案--------------------</font><br>XML和HTML不能同时输出!<br><br>......<br>       echo '';<br>exit;    <br>?><br><br><br><br> <div class="clear">
                 
              
              
        
            </div>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn