2013-03-17 66 views
0

我想验证网站http://www.athometechsolutions.net/index.php,我遇到了麻烦。PHP网站代码验证,并不同时验证

当我键入URL到W3验证服务,我得到以下错误:

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. 

不过,我看不出什么毛病的代码。而且,更令人费解的是,当我将“view-source”代码复制并粘贴到W3验证服务中时,它会通过。

我真的很想让它通过它自己,我不明白为什么它不会。

在我看来,它与文档头部的第一个php include有关,因为当我将块从include移入常规头时,错误消息位置会发生变化。但是,在我看来,它应该加载得很好(从PHP - Is it dumb to load <head></head> data as an include和其他文件)。

所以,我问,我怎么能通过URL验证它?

谢谢!

回答

1

在Notepad ++的HEX编辑器视图中查看页面的源代码显示,在验证程序提到的元素元素之前,您有一个字节顺序标记。

由于大多数编辑不显示字节顺序标记,所以很难发现。

And, what makes it even more puzzling, is that when I copy and paste the "view-source" code into the W3 validation service, it PASSES.

因为一个字节顺序标记只在文档的开头是有道理的,最有可能你的编辑器(或链中的另一个组件)安静的删除它,当你复制&其粘贴到验证。