Most browsers now support page compression Output. by compressing the output, the page size can be reduced by 30%. Because version 3.0 does not have the built-in page compression output function, generally, you need to add it in the entry File: most browsers now support page compression Output. by compressing the output, the page size can be reduced by 30%. Because version 3.0 does not have the built-in page compression output function, therefore, you need to add the following in the entry file:
- Ob_start ('OB _ gzhandler ');
Copy the code, but because of the different server environments, sometimes this configuration conflicts with the zlib compression configuration in the php. ini file. The new version 3.1 has built-in page compression output function. you do not need to manually add the ob_gzhandler code, add OUTPUT_ENCODE configuration parameters, and support detection of zlib. output_compression.
By default, the framework compresses the page output and automatically detects zlib. output_compression configuration, if php. zlib in ini. when output_compression is enabled, the page is still compressed by page compression in the server environment.
The related code is just one line:
- If (! Ini_get ('zlib. output_compression') & C ('output _ encoding') ob_start ('OB _ gzhandler ');
If an error similar to the following occurs when copying code in some special environments:
- Output_handler "ob_gzhandler" conflicts with "zlib. output_compression"
The replication code is usually caused by conflicts when other compression methods are configured on your server. in this case, you can manually disable OUTPUT_ENCODE, that is:
- 'Output _ encode' => false