-1

我正在尝试验证我的 CSS/PHP 文件,但收到此错误:未知错误 org.w3c.www.http.HttpInvalidValueException:内容类型无效。

我正在使用这样的 PHP 标头:<?php header("Content-type: text/css; charset: UTF-8");?>
但是 CSS Validator 会引发错误。

所以我将我的代码更改为:<?php header("Content-type: text/css; charset: utf-8");?>它再次引发错误:(

但是,如果我将代码更改为:<?php header("Content-type:text/css;");?> 它通过验证...

我不确定为什么会发生这种情况(可能是因为我在 HTML 页面中定义了 UTF-8 字符集?)。

那么有人可以告诉我我做错了什么吗?

如果值得我的 HTML 看起来像这样:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>My Site Title</title> 
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="stylesheet" type="text/css" media="all" href="http://www.mypage.com/foldername/wp-content/themes/MyTheme/css/style.css">
<link rel="stylesheet" type="text/css" media="all" href="http://www.mypage.com/foldername/wp-content/themes/MyTheme/functions/dynamic_css.php">
</head>
4

1 回答 1

4
"Content-type: text/css; charset: UTF-8" 

应定义为:

"Content-type: text/css; charset= UTF-8"
于 2013-05-24T19:47:33.300 回答