将.html文件更改为.php

时间:2015-10-26 21:22:55

标签: php html css zurb-foundation

这个问题是index.html文件所独有的,正如我之前所说的,当它是html时起作用的CSS在扩展名更改时停止工作。我检查了两个实例上的ref链接,当它是一个php时,CSS文件最终成为php文件本身。我假设它可能因某些奇怪的原因无法访问css?我不确定只有当它是一个php时才能转化为什么。我已经对其他页面执行了相同的操作,并且工作正常。

如果它意味着什么,停止工作的部分原因是我使用的基金会。

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation</title>
<link rel="stylesheet" href="stylesheets/app.css" />
<link rel="stylesheet" href="stylesheets/main.css" />
<script src="bower_components/modernizr/modernizr.js"></script>
<script src="js/foundation/foundation.js"></script>
<script src="js/foundation/foundation.clearing.js"></script>
</head>

我还发现任何href链接都会停止工作。

1 个答案:

答案 0 :(得分:2)

我猜它是使用错误的MIME类型传递的。尝试通过设置如下所示的标题强制CSS MIME类型:

header("Content-type: text/css");

此外,请确保使用PHP,您应该使用服务器执行。即,以下网址是正确的:

http://domain/path/to/index.php
http://localhost/project/index.php

而不是:

file:///c:/wamp/www/project/index.php
file:///c:/myproject/index.php
file:///c:/xampp/htdocs/index.php