php ob_start(ob_gzhandler)进行网页压缩
本文章来总结关于php ob_start(ob_gzhandler)进行网页压缩传输的实现有需要的朋友可参考一下。
先来看ob_start用法
使用PHP ob_start()函数打开browser的cache,这样可以保证cache的内容在你调用flush(),ob_end_flush()(或程序执行完毕)之前不会被输出
代码如下 | 复制代码 |
ob_start(); //打开缓冲区 ?> |
PHP ob_start()函数一个很大的特点;也可以使用ob_start的参数,在cache被写入后,然后自动运行命令,比如ob_start(”ob_gzhandler”);而我们最常用的做法是用ob_get_contents()得到cache中的内容
面的代码是一个压缩网页的例子,我 们利用ob_gzip函数,使用ob_start将输出内容压缩后放到“缓冲区”后再输出。
代码如下 | 复制代码 |
//启用压缩 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
