-
-
Save hiscaler/1794759 to your computer and use it in GitHub Desktop.
Yii enable gzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GzipBehavior extends CBehavior | |
{ | |
public function events () | |
{ | |
return array ( 'onBeginRequest' => 'beginRequest','onEndRequest' => 'endRequest' ); | |
} | |
public function beginRequest () | |
{ | |
return ob_start ( "ob_gzhandler" ); | |
} | |
public function endRequest () | |
{ | |
return ob_end_flush (); | |
} | |
} | |
//on index.php | |
$app->attachBehavior('GzipBehavior','application.behavior.GzipBehavior'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment