Compressing page content with PHP

By compressing page content with PHP, you can earn half the size of your page. With this size you earn, you’ll be able to load your site speed faster, and that’s what Google likes. Google likes it in the rankings. It allows you to be easily found in searches and gains in traffic that you spend.
First, place these codes in the PHP code included on each page of your software (functions can be. php or database. php file)

$gzip_pres = true; 
function gzipKontrol() 
{ 
    $kontrol = str_replace(" ","", 
        strtolower($_SERVER['HTTP_ACCEPT_ENCODING']) 
    ); 
    $kontrol = explode(",", $kontrol); 
    return in_array("gzip", $kontrol); 
} 
function bosluksil($kaynak) 
{ 
    return preg_replace("/\s+/", " ", $kaynak); 
} 
function phpPress($kaynak) 
{ 
    global $gzip_pres; 
    $sayfa_cikti = bosluksil($kaynak); 
    if (!gzipKontrol() || headers_sent() || !$gzip_pres)  
        return $sayfa_cikti; 
    header("Content-Encoding: gzip"); 
    return gzencode($sayfa_cikti); 
}

After you add this code, paste the following code at the beginning of the page that you want to compress.

ob_start("phpPress");

That’s all, plenty of traffic days.

Leave a Reply

Your email address will not be published. Required fields are marked *