gpt4 book ai didi

php - 将页面作为 text/xml 和 application/xhtml+xml 有什么区别?

转载 作者:太空宇宙 更新时间:2023-11-04 15:22:50 25 4
gpt4 key购买 nike

作为 text/xmlapplication/xhtml+xml 提供页面有什么区别?

最佳答案

引自 specification :

The 'application/xhtml+xml' media type [RFC3236] is the primary media type for XHTML Family documents. 'application/xhtml+xml' should be used for serving XHTML documents to XHTML user agents (agents that explicitly indicate they support this media type). This media type must be used when writing documents using XHTML Family document types that add elements and attributes from foreign namespaces, such as XHTML+MathML [XHTML+MathML].

因此,如果客户端支持,请使用 application/xhtml+xml 为您的 XHTML 页面提供服务,否则您可以使用 text/html

来自 specification 的另一句话:

  1. If the Accept header explicitly contains application/xhtml+xml (with either no "q" parameter or a positive "q" value) deliver the document using that media type.

  2. If the Accept header explicitly contains text/html (with either no "q" parameter or a positive "q" value) deliver the document using that media type.

  3. If the accept header contains "* /*" (a convention some user agents use to indicate that they will accept anything), deliver the document using text/html.

In other words, requestors that advertise they support XHTML family documents will receive the document in the XHTML media type, and all other requestors that (at least claim to) support HTML or "everything" will receive the document using the HTML media type. Dealing with user agents that satisfy none of these criteria is outside the scope of this document.

When an XHTML document does NOT adhere to the guidelines, it should only be delivered as media type application/xhtml+xml.

text/xml 不应用于提供 XHTML 网页。您可以使用它来提供其他不代表 XHTML 的 XML 文档。

关于php - 将页面作为 text/xml 和 application/xhtml+xml 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6788934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com