Ò»¡¢ÒýÂÛ
PHP,Ò»ÃÅ×î½ü¼¸ÄêÐËÆðµÄwebÉè¼Æ½Å±¾ÓïÑÔ,ÓÉÓÚËüµÄÇ¿´óºÍ¿ÉÉìËõÐÔ,½ü¼¸ÄêÀ´µÃµ½³¤×ãµÄ·¢Õ¹,phpÏà±È´«Í³µÄaspÍøÕ¾,ÔÚËÙ¶ÈÉÏÓоø¶ÔµÄÓÅÊÆ,Ïëmssqlת6ÍòÌõÊý¾ÝphpÈçÐèÒª40Ãë,asp²»ÏÂ2·ÖÖÓ.µ«ÊÇ,ÓÉÓÚÍøÕ¾µÄÊý¾ÝÔ½À´Ô½¶à,ÎÒÃÇ¿ÊÇóÄܸü¿ìËٵĵ÷ÓÃÊý¾Ý,²»±ØҪÿ´Î¶¼´ÓÊý¾Ý¿âµô,ÎÒÃÇ¿ÉÒÔ´ÓÆäËûµÄµØ·½,±È·½Ò»¸öÎļþ,»òÕßij¸öÄÚ´æµØÖ·,Õâ¾ÍÊÇphpµÄ»º´æ¼¼Êõ,Ò²¾ÍÊÇCache¼¼Êõ.
¶þ¡¢·ÖÎöÉîÈë
Ò»°ãÀ´Ëµ,»º´æµÄÄ¿µÄÊÇ°ÑÊý¾Ý·ÅÔÚÒ»¸öµØ·½È÷ÃÎʵĸü¿ìµã,ºÁÎÞÒÉÎÊ,ÄÚ´æÊÇ×î¿ìµÄ,µ«ÊÇ,¼¸°ÙMµÄÊý¾ÝÄÜÍùÄÚ´æ·Åô?Õâ²»ÏÖʵ,µ±È»,ÓеÄʱºòÁÙʱ·ÅÈç·þÎñÆ÷»º´æ,Èçob_start()Õâ¸ö»º´æÒ³Ã濪ÆôµÄ»°ÔÚ·¢ËÍÎļþͷ֮ǰҳÃæÄÚÈݶ¼±»»º´æÔÚÄÚ´æÖÐ,ÖªµÀµÈÒ³ÃæÊä³ö×Ô¶¯Çå³þ»òÕߵȴýob_get_contentsµÄ·µ»Ø,»òÕß±»ob_end_cleanÏÔʾµÄÇå³ý,ÕâÔÚ¾²Ì¬Ò³ÃæµÄÉú³ÉÖÐÄܺܺõÄÀûÓÃ,ÔÚÄ£°åÖÐÄܵõ½ºÜºÃµÄÌåÏÖ,ÎÒµÄÕâƪÎÄÕÂÉîÈëµÄÌÖÂÛÁË:̸PHPÉú³É¾²Ì¬Ò³Ãæ,ÕâÊÇÒ»ÖÖ·½Ê½,µ«ÕâÊÇÁÙʱÐÔµÄ,²»Êǽâ¾öÎÒÃÇÎÊÌâµÄºÃ·½·¨.
ÁíÍâ,ÔÚaspÖÐÓÐÒ»¶ÔÏóapplication,¿ÉÒÔ±£´æ¹«ÓõIJÎÊý,ÕâÒ²Ëãµã»º´æ,µ«ÔÚphp,ÎÒÖÁ½ñû¿´µ½¿ª·¢Õß²ú³öÕâÖÖ¶ÔÏó,µÄÈ·,û±ØÒª.asp.netµÄÒ³Ã滺´æ¼¼Êõ¾ÍÓõÄÊÇviewstate,¶øcache¾ÍÊÇÎļþ¹ØÁª,(²»Ò»¶¨×¼È·),Îļþ±»ÐÞ¸Ä,¸üлº´æ,Îļþû±»Ð޸ĶøÇÒ²»³¬Ê±(×¢ÊÍ1),¾Í¶ÁÈ¡»º´æ,·µ»Ø½á¹û,¾ÍÊÇÕâ¸ö˼·,¿´¿´Õâ¸öÔ´Âë:
<?php
class cache{
/*
Class Name: cache
Description: control to cache data,$cache_out_time is a array to save cache date time out.
Version: 1.0
Author: ÀÏÅ© cjjer
Last modify:2006-2-26
Author URL:[url=http://www.cjjer.com]http://www.cjjer.com[/url]
*/
private $cache_dir;
private $expireTime=180;//»º´æµÄʱ¼äÊÇ 60 Ãë
function __construct($cache_dirname){
if(!@is_dir($cache_dirname)){
if(!@mkdir($cache_dirname,0777)){
$this->warn('»º´æÎļþ²»´æÔÚ¶øÇÒ²»ÄÜ´´½¨,ÐèÒªÊÖ¶¯´´½¨.');
return false;
}
}
$this->cache_dir = $cache_dirname;
}
function __destruct(){
echo 'Cache class bye.';
}
function get_url() {
&