开发者

How do I return the MIME type for a font?

开发者 https://www.devze.com 2023-01-12 10:34 出处:网络
Proper MIME type for fonts This matter is solved but i dont know how to do. help me I use cakePHP , I read RequestHanlder Componen开发者_如何学运维t in bookcake but i dont ever use MIME. header(\'Cont

Proper MIME type for fonts This matter is solved but i dont know how to do. help me I use cakePHP , I read RequestHanlder Componen开发者_如何学运维t in bookcake but i dont ever use MIME.


header('Content-Type: font/opentype');

Put this anywhere in the controller before any output. This is standard PHP and doesn't have much to do with Cake. You can use RequestHandlerComponent::respondAs() to set this as well, which in the end does the same thing.

This only makes sense though if you're serving the font files using Cake/PHP at all. If they're just files in the /webroot folder that get served by your web server (Apache?), then neither PHP nor Cake have anything to do with it. In that case you need to instruct your web server to serve certain files with certain types. See here for an example.

0

精彩评论

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

关注公众号