![]() |
Just put following codes of your top of site. Better to put codes into header.php most top. |
Example:
PHP
<?php
function minify_output($buffer){
$search = array('/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s');
$replace = array('>','<','\\1');
if (preg_match("/\<html/i",$buffer) == 1 && preg_match("/\<\/html\>/i",$buffer) == 1) {
$buffer = preg_replace($search, $replace, $buffer);
$buffer = str_replace(array("\r", "\n"), '', $buffer);
}
return $buffer;
}
ob_start("minify_output");?>
php minify |
How to create title to url/slug in PHP | PHP Function Tutorial |
How to minify all html in a single line with PHP | PHP Function Tutorial |
How to add a url with php_curl fuctionally cURL | PHP Function Tutorial |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | PHP Function Tutorial |
Uploaded by: | Admin |