网页无法在托管上运行?" />

为什么当添加 网页无法在托管上运行?

发布于 2024-10-06 14:56:51 字数 534 浏览 0 评论 0 原文

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

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

该页面不起作用。我想知道为什么。

这是完整的标题:

<?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 短标签已打开。

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.

This is the full header:

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

The server returns me a blank page


Issue solved: The PHP short tags was open.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

锦爱 2024-10-13 14:56:51

我最好的猜测是:

...因此服务器尝试将 XML 声明作为 PHP 代码进行处理。通常我会收到错误消息,但也许有一个 PHP 设置可以抑制客户端的错误,以避免泄露可能对尝试安全漏洞的人有用的数据。

只需将其删除即可。

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

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

My best guess is that:

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

爱人如己 2024-10-13 14:56:51
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>

<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文