Does Apache 2 gzip json output by default?

前端 未结 2 1973
日久生厌
日久生厌 2021-02-19 11:04

I\'m using this PHP code for json output. Does apache gzip it by default? Or, how can I check to make sure?

header(\'Content-type: application/json\');
header(\'         


        
2条回答
  •  被撕碎了的回忆
    2021-02-19 11:27

    No gzip is normally not used you have to enforce that yourself.

    In the simplest case you just need to add this php line:

    ob_start("ob_gzhandler");
    

    See also the official php documentation.

提交回复
热议问题