我分析了我的网站,发现我在使用以下描述减少 HTTP 请求方面获得了 F 级:
This page has 6 external Java script scripts. Try combining them into > one. This page has 3 external style sheets. Try combining them into > one. This page has 18 external background images. Try combining them > with C SS sprites.
我怎样才能发烧? 如何使用 C SS Sprite 组合图像?
最佳答案
什么是 CSS Sprites ?
An image sprite is a collection of images put into a single image. A web page with many images can take a long time to load and generates multiple server requests. Using image sprites will reduce the number of server requests and save bandwidth.
要制作 Sprite ,请检查此 online service
对于您的 javascript
和 css
问题。您需要的是一个压缩器
。如果您真的想按照说明进行操作。这是 css/javascript compressor 的示例(有替代方法,快速 google 会有所帮助)
但我个人在将所有脚本放入一个文件时遇到了问题。请记住,最好只添加页面实际需要的外部脚本。
和
我可以建议使用 cdn
来帮助加速静态文件的服务。 Google 有一项服务 ( Google PageSpeed ),但最后我检查它仍然只是受邀(刚刚检查它是在 Limited free trial
上)。另一种选择是 cloudflare .
干杯!
关于php - 如何减少 HTTP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17670252/