Sau đây là nội dung file:
<?phpthiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
class cachethiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
var $cache_dir = './cache/';thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
var $cache_time = 100000;// Thời gian để tạo cache mớithiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
var $caching = false;thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
var $file = '';thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
function cache()thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$this->file = $this->cache_dir . urlencode( $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] );thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
if ( file_exists ( $this->file ) && ( fileatime ( $this->file ) + $this->cache_time ) > time() )thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$handle = fopen( $this->file , "r");thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
do {thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$data = fread($handle, 8192);thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
if (strlen($data) == 0) {thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
break;thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
echo $data;thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
} while (true);thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
fclose($handle);thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
exit();thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
elsethiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$this->caching = true;thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
ob_start();thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
function close()thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
if ( $this->caching )thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
{thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$data = ob_get_clean();thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
echo $data;thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
$fp = fopen( $this->file , 'w' );thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
fwrite ( $fp , $data );thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
fclose ( $fp );thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
}thiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
?>
Các bạn có thể copy và lưu vào 1 thư mục nào đóthiết kế web giá rẻ Việt Nam
thiet-ke-web-gia-re-viet-nam
Chú ý:
var $cache_dir = './cache/';
Tạo thư mục cache ngang hàng với file index.php của bạn và nhớ CMODE quyền ghi thư mục này cho nó
- 10 thủ thuật quảng bá Web giúp bạn tạo tiêu đề bài viết hấp dẫn người đọc và máy tìm kiếm.
- Hướng dẫn cài đặt Memcache cho VBB
- Custome Style với PHP và CSS
- Tạo website cá nhân dễ dàng với SnapPages.com




