Why when add <?xml version=“1.0” encoding=“utf-8”?> to web page don´t work on hosting?

后端 未结 2 366
旧时难觅i
旧时难觅i 2020-12-12 01:33

I am developing a simple webpage at hostgator.com. I have the standard headers, but when I add the following line:



        
相关标签:
2条回答
  • 2020-12-12 01:58
    <?php
    echo '<?xml version="1.0" encoding="utf-8"?>';
    ?>
    
    
    0 讨论(0)
  • 2020-12-12 02:12

    My best guess is that:

    • The document is being processed as PHP
    • Short Tags are turned on

    … so the server is trying to process the XML declaration as PHP code. Normally I'd expect an error message, but perhaps there is a PHP setting in play that suppresses errors to the client to avoid leaking data that could be potentially useful to someone trying a security exploit.

    Just remove it.

    • UTF-8 is the default
    • version 1.0 is the default
    • It is optional in the spec
    • Given a text/html content-type, an XML prolog will trigger IE6's quirks mode

    The latter is undesirable. The former all mean it makes no difference.

    0 讨论(0)
提交回复
热议问题