【发布时间】:2013-03-17 01:45:06
【问题描述】:
我正在尝试验证网站 http://www.athometechsolutions.net/index.php,但遇到了问题。
当我在 W3 验证服务中键入 URL 时,我收到以下错误:
Error Line 12, Column 1: character data is not allowed here
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:
putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.
但是,我看不出代码有什么问题。而且,更令人费解的是,当我将“查看源代码”代码复制并粘贴到 W3 验证服务中时,它通过了。
我真的很想让它自己传递,但我不知道为什么它不会。
在我看来,这与文档头部的第一个 php 包含有关,因为当我将部分从包含中移出并进入常规标题时,错误消息的位置会发生变化。但是,在我看来,它应该可以正常加载(来自PHP - Is it dumb to load <head></head> data as an include 和其他文档)。
所以,我问,我怎样才能让它通过 URL 进行验证?
谢谢!
【问题讨论】:
标签: validation head php-include