为什么在添加<?xml version ="1.0"时encoding ="utf-8"?网页无法托管吗? [英] Why when add <?xml version="1.0" encoding="utf-8"?> to web page don´t work on hosting?

查看:419
本文介绍了为什么在添加<?xml version ="1.0"时encoding ="utf-8"?网页无法托管吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在hostgator.com上开发一个简单的网页. 我有标准标题,但是当我添加以下行时:

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

<?xml version="1.0" encoding="utf-8"?> 

该页面不起作用.我想为什么.

the page does not work. I would like why.

这是完整的标题:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es"> 
... rest of code ...

服务器向我返回空白页

问题已解决: PHP短标签已打开.

Issue solved: The PHP short tags was open.

推荐答案

我最好的猜测是:

…因此服务器正在尝试将XML声明作为PHP代码处理.通常,我希望收到一条错误消息,但是可能正在使用PHP设置来抑制向客户端的错误,从而避免泄漏数据,这些数据可能对尝试使用安全漏洞的人有用.

… 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.

只需将其删除.

  • 默认为UTF-8
  • 版本1.0为默认
  • 它在规范中是可选的
  • 给出text/html内容类型,XML序言将触发IE6的怪癖模式

后者是不可取的.前者都意味着没有区别.

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

这篇关于为什么在添加&lt;?xml version ="1.0"时encoding ="utf-8"?网页无法托管吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆