gpt4 book ai didi

php - Chrome 将 CSS 样式表解释为图像

转载 作者:可可西里 更新时间:2023-10-31 22:57:23 24 4
gpt4 key购买 nike

在我的 CodeIgniter 网站中,当在 Chrome 中查看时,控制台显示警告

style.css 解释为 IMAGE 但以 MIME 类型 text/css 传输

页面按照我的预期呈现,但是当我右键单击并检查任何元素时,它的“计算样式”显示为空白,这使得调试变得困难。

这就是我提供 CSS 文件的方式

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?></title>
<link rel="icon" type="image/png" href="<?= base_url('assets/images/favicon.png'); ?>" />
<link rel="stylesheet" type="text/css" media="all" href="<?= base_url('assets/css/style.css');?>" />
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700|Open+Sans+Condensed:300,300italic,700' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>

使用 Chrome 扩展程序,我在请求 style.css 时监控了 header 的发送,这就是我得到的:

enter image description here

编辑

这是在共享的 godaddy 主机上的 LAMP 服务器上。我的重写 htaccess 仅包含以下重写规则:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule ^(.*)$ /index.php?$1 [L]

最佳答案

这很可能是由 css 文件中的无效相对路径引起的。

例如 在 html 中可以通过添加 <img src="" /> 来复制类似的消息它将被解析为相对路径并解析为 *current_page_url* - 提示“...但使用 MIME 类型文本/html 传输”错误。

关于php - Chrome 将 CSS 样式表解释为图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11182762/

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