1//檔案快取類23
class
filecache
14}
15}
1617
//設定快取
18public
function set($key,$val,$lefttime=null
)
2829
//得到快取
30public
function get($key
)
38return
null
;
39}
4041
//判斷檔案是否有效
42public
function _isset($key
)else
52}
53return
false
; 54
}
5556
//刪除檔案
57public
function _unset($key
)
63return
false
;
64}
6566
//清除過期快取檔案
67public
function
clear()
73}
74}
7576
//清除所有快取檔案
77public
function
clear_all()
82}
8384
private
function error($line,$msg
)
呼叫方法:
//cachetime 快取時間 1個小時
$cachefile = new filecache(array('cachetime'=>3600,'suffix'=>'.php'));
$cache_1 =$cachefile->get('key1');
$cache_2 =$cachefile->get('key2');
if( $cache_1
)else
php檔案快取類
檔案快取類 class infobird cache file 設定快取基礎目錄 param string basepath return void throw exception public function setbasepath basepath this basepath basepath...
php 檔案快取
class cache return self instance 得到快取資訊 param string id return boolean array public static function get id file instance file id data instance fileget...
PHP檔案快取
專案中要用到臨時儲存乙個陣列,於是想利用php的檔案操作來臨時儲存陣列。php 4,php 5,php 7 fopen 開啟檔案或者 url resource fopen string fi lena me,s trin g mode bool us einc lude path fal se re...