I am not asking for an online tool. I'm also not asking how to turn o开发者_Python百科n or turn off gzip.
What I want to know, is how, within my php, that I can check to see if gzip will encode the current buffer or not.
I'm not 100% sure what you mean by gzip will encode the current buffer
but i assume you mean "compress the output before sending it"
if(ini_get("zlib.output_compression")) {
echo "On";
} else {
echo "off";
}
Should you be talking about ob_*
functions and output streams there is ob_get_status
but afaik you can't check if that was started with ob_gzhandler()
or not. Your application would have to track that. But zlib compression is preferred anyways
If you mean that you want to know whether or not mod_deflate in Apache has been activated, there's no API in PHP to determine that. You could, obviously, use a shell command and parse the output, but it's probably not the preferred way. The question is though: why should PHP care if the output is gzipped?
probably like so:
ini_get('zlib_output_compression');
(for the manual see here: http://php.net/manual/en/function.ini-get.php )
精彩评论