开发者

WAMP not sending file headers (content-type) correctly

开发者 https://www.devze.com 2022-12-22 13:58 出处:网络
I cant get a PHP file to send correct headers at my WAMP server. Wouldn\'t be a problem normally except that is phpMyAdmin that is freaking out and that the main css files are not working in Firefox.

I cant get a PHP file to send correct headers at my WAMP server. Wouldn't be a problem normally except that is phpMyAdmin that is freaking out and that the main css files are not working in Firefox.

Here's the row that in the file that merges the css files together, used to send the output as CSS.

header('Content-Type: text/css; charset=UTF-8');

I have also putted a .htaccess file in the phpmyadmin directory:

AddType text/css .css

Neither is working. What can I do to make sure that this file is interpreted as a CSS开发者_JAVA技巧 by firefox?


The Addtype directive is irrelevant - that tells the default handler to use the specified mimetype - in the case of PHP, you are not using the default handler.

The header comand should work set the mimetype header correctly - and the behaviour you describe does suggest that it is failing.

The most common reason for this fail is that the headers have already been flushed and body output has started before PHP gets to the header script. This can be due to all sorts of things (including BOM markers in UTF8 text files - which you can't usually see in your source code).

This also implies that your error handling / loging is broken - or you don't know where to lok for errors - take some time out to read the manual on how to configure error reporting.

C.

0

精彩评论

暂无评论...
验证码 换一张
取 消