gzip压缩压缩方式压缩率
Compression is a simple way to speed up the site. PHP’s gzip compression is excellent. And using it is very convenient:
压缩是加快站点速度的简单方法。 PHP的gzip压缩非常出色。 并且使用它非常方便:
Simply put these codes before any HTML content at the beginning of the PHP script:
只需将这些代码放在PHP 脚本开头的任何HTML内容之前:
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start("ob_gzhandler");
else ob_start();
?>
In WordPress, the suitable position for these codes is the beginning of the header.php file of the theme.
在WordPress中,适合这些代码的位置是theme的header.php文件的开头。
翻译自: https://www.systutorials.com/speeding-up-the-site-by-using-php-gzip-compression/
gzip压缩压缩方式压缩率