PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Raul Molnar   PHP Server and Browser Cache   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Server side demo
Class: PHP Server and Browser Cache
Cache pages on the server and on the browser side
Author: By
Last change:
Date: 11 years ago
Size: 1,021 bytes
 

Contents

Class file image Download
<?php

include_once "class/cache.php";

// very important! session_start(); or start cookie here
error_reporting(E_ALL & ~E_NOTICE );
//basic usage

$folder=$_SERVER['DOCUMENT_ROOT']."/cache/cache_"; // you need to set your path here
$cache=new CACHE();
$cache->setRoot($folder); // the cached files will be saved locally (if server side caching) here
$cache->setCacheType(1); //server side
$cache->setFileExtension("html"); // will save cached files as html, will make this easier to check the saved files
$cache->startCache(); // will start caching process


?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cache class demo</title>
</head>
<body>
<?php
$string
="";
for (
$i=1; $i<100000; $i++) $string.= ($i+3.324324324 * $i*pi()/2);
echo
"String=".md5($string);
?>
</body>
</html>