资源解释为文档,但使用 MIME 类型 text/css 传输

2024-08-22php开发问题
3

本文介绍了资源解释为文档,但使用 MIME 类型 text/css 传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

资源解释为文档,但使用 MIME 类型 text/css 传输

这是在 Google Chrome Inspector 中显示的错误.

This is the error that's showing up in Google Chrome Inspector.

文件是:http://www.doanddare.org/css/style.css

它正在由 php 处理器呈现.

It is being rendered by a php processor.

我该如何解决这个错误?

How can I fix this error?

返回的标题是:

Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3

响应标头

HTTP/1.1 200 OK
Date: Sun, 10 Oct 2010 07:35:04 GMT
Server: Apache
content-style-type: text/css
Expires: Thu, 10 Oct 2030 03:50:23 GMT
Cache-Control: max-age=631138519, public
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/css
Connection: Keep-Alive

这可能与作为文档发送的请求标头和作为 css 文件返回的响应标头有关吗?

Could it be something to do with the request headers being sent as a document and the response headers returned as a css file?

如果是这样,我应该如何控制请求头?

If so, how should I control the request headers?

感谢您的帮助.

推荐答案

我只在 Chrome 上查看特定资源时出现错误.当我尝试打开 Javascript 文件 (.js) 时也会发生这种情况.

I only get error that when I view the specific resource on Chrome. This also happens when I try to open a Javascript file (.js).

我的结论是,当您在 Chrome 中打开组件文件(.css、.js)时,它会尝试将其解释为文档(在屏幕上显示输出),而不是将其解释为其原生 MIME 类型.

My conclusion is that when you open a component file (.css, .js) in Chrome, it will try to interpret as document (showing output on the screen), instead of interpreting it as its native MIME type.

说一个 Javascript 文件.如果你在 Chrome 中输入它,它应该被解释为文档(在屏幕上显示输出),而不是 Chrome 执行脚本(这是它的原生 MIME 类型所做的).

Say a Javascript file. If you enter it in Chrome, it should be interpreted as document (showing output on the screen), instead of Chrome executing the script (that's what its native MIME type does).

该消息仅适用于 Google Chrome,可以忽略不计,因为它仅在您打开组件文件时出现.

That message is Google Chrome only and is negligible, as it only appear when you open a component file.

这篇关于资源解释为文档,但使用 MIME 类型 text/css 传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17