php - 如何减少 HTTP 请求?

标签 php javascript html css joomla2.5

我分析了我的网站,发现我在使用以下描述减少 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

对于您的 javascriptcss 问题。您需要的是一个压缩器。如果您真的想按照说明进行操作。这是 css/javascript compressor 的示例(有替代方法,快速 google 会有所帮助)

但我个人在将所有脚本放入一个文件时遇到了问题。请记住,最好只添加页面实际需要的外部脚本。

我可以建议使用 cdn 来帮助加速静态文件的服务。 Google 有一项服务 ( Google PageSpeed ),但最后我检查它仍然只是受邀(刚刚检查它是在 Limited free trial 上)。另一种选择是 cloudflare .

干杯!

关于php - 如何减少 HTTP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17670252/

相关文章:

php - 将元数据属性添加到 MySQL 表

javascript - 我的jQuery验证不适用于我的php/html表单,不确定为什么

javascript - SmoothScroll 导航不适用于 bootstrap 4

java - XMLHttpRequest POST 之后下载 png 文件

php - 有条件地构建 Eloquent 查询

php - 使用 PCRE 正则表达式解析多行 ini 之类的文件

javascript - jQuery UI Datepicker 和 datejs

html - Bootstrap 4.0 卡片图片大小不一样

html - 在 Outlook 中打开 .OFT 的超链接

javascript - +/- Shopify 购物车中的数字增量