gpt4 book ai didi

php - 如何强制浏览器缓存文本文件 (.ttf)

转载 作者:行者123 更新时间:2023-11-28 17:06:10 25 4
gpt4 key购买 nike

我正在制作一个网站。在 http://snpskollam.cf并且在 http://chemio.cf 上也有制作另一个的经验我面临一个问题,IE。我的服务器中有一个文本文件 (MontserratRegular.ttf)。我将此文件链接到所有页面的每个“.css”。问题是,浏览器会根据每个页面的请求下载它以供阅读。文本文件大约 250KB,大小有点大。这可能会打扰网速较慢的人。有解决方案吗?

最佳答案

配置您的网络服务器以传送缓存 header 。例如,使用 apache 网络服务器和 mod_expires:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 300 seconds"

ExpiresByType image/gif "access plus 1 month 1 hour"
ExpiresByType image/jpg "access plus 1 month 1 hour"
ExpiresByType image/jpeg "access plus 1 month 1 hour"
ExpiresByType image/png "access plus 1 month 1 hour"
ExpiresByType application/x-shockwave-flash "access plus 1 day 1 hour"
</IfModule>

使用 ttf 文件根据您的需要进行自定义。

关于php - 如何强制浏览器缓存文本文件 (.ttf),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49382815/

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