Home >Backend Development >PHP Tutorial >Content encoding error occurs in firefox_PHP tutorial
Firefox prompts that the content encoding error occurs when accessing a program using PHP with a browser. The page you are trying to view cannot be displayed because it uses an invalid or unsupported compression format. Under IE, it is 'The page cannot be displayed'. Use ThinkPHP framework, I never knew the reason. Later, I checked step by step and found that it was caused by using ob_start('ob_gzhandler') in the program.
The solution to this problem is actually very simple. The following two problems may cause this problem.
1. The server does not support this compression format. You can use function_exists('ob_gzhandler') to judge. The solution is to change ob_start('ob_gzhandler') to ob_start();
2. When using ob_start('ob_gzhandler'), the previous content has been output. Check the previous content and the content of the require include calling file. If it cannot be found, you can use ob_start() before calling other files, and use ob_end_clean () after calling to clear the output content;
The error I encountered was because there was output content before ob_start. That's why the program cannot run.