<?php if($_GET['phphuancun']!="true"){ define("HC_PATH",dirname(__FILE__)."/cache/"); define("HC_TIME",1); echo HC_getcache();exit; } function HC_getcache($iscache='') { $url="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $cacheurl=strpos($url,"?")?$url."&phphuancun=true":$url."?phphuancun=true"; $cachename=HC_PATH.md5($url).".c"; $cachetime=$iscache?time()+1:time()-(HC_TIME * 60*60); if(file_exists($cachename) && filemtime($cachename)>=$cachetime){ $return=file_get_contents($cachename);$data=function_exists(gzcompress)?@gzuncompress($return):$return; return unserialize($data); }else{$return=file_get_contents($cacheurl);HC_writecache($cachename,$return);return $return;} } function HC_writecache($name,$array) { function_exists(gzcompress)?$return =gzcompress(serialize($array)):$return=serialize($array); @file_put_contents($name,$return); } ?>