簡單的php文件緩存類_PHP教程
推薦:PHP判斷后綴名和隨機命名實例具體請看下文代碼示例 form.php html head meta http-equiv = content-type content = text/html charset = utf-8 title UploadImage / title / head body form method = post action = upload.php enctype = multipart/form-data input type = hidden name = MAX_FILE
一個超簡單的PHP緩存類代碼,使用緩存對于php項目的開發(fā)來說特別重要,特別是大型項目,可以大幅提高程序性能。
這個php緩存類的使用方法:
第一步:實例化類
$cache = new Cache();
第二步:設置緩存時間和緩存目錄
$cache = new Cache(60, '/any_other_path/');
第一個參數(shù) 60 是緩存秒數(shù),第二個參數(shù)是緩存路徑,根據(jù)個人的需要自行配置。
不填寫的時候,默認的緩存時間是 3600 秒,緩存的目錄是 cache/
3、讀取緩存
$value = $cache->get('data_key');
4、寫入緩存
$value = $cache->put('data_key', 'data_value');
點擊下面的鏈接,下載這個簡單的php環(huán)城路的源代碼試一下吧!
分享:php多文件上傳封裝多文件的上傳實現(xiàn) 1 利用單文件封裝 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equiv= Content-Type content= text/html; charset=UTF-8 title
- 相關鏈接:
- 教程說明:
PHP教程-簡單的php文件緩存類
。