0
我的php代碼有問題。我用這個函數使用一個簡單的緩存系統。緩存後的PHP代碼[如何]
// Cache Function
function cachestart($min){
global $here;
global $cachefile;
$cachedosyasi = 'cache/' . 'file' . md5($here);
if(file_exists($cachefile) && (time() - $min*60 < filemtime($cachefile))){
include($cachefile);
die;
}else{
ob_start();
global $cache;
$cache = 1;
}
}
function cachefinish(){
global $cache;
global $cachefile;
if(@$cache){
$ch = fopen($cachefile, 'w');
fwrite($ch, ob_get_contents());
fclose($ch);
ob_end_flush();
}
}
我'嘗試是:
-- Some Queries (Controls, is user logged etc.)
<< Start Caching >> (With cachestart())
-- Some Queries (Show entries in database.)
<< Stop Caching >> (With cachefinish())
-- Some Queries (Comment box)
但我不能這樣,因爲 「死」。我對此一無所知。
感謝您的幫助!
所有查詢重新工作,我看到緩存之間的雙重一切:
在您的應用程序的啓動做出決定功能。 編輯:有人說「刪除'死'功能」,但評論刪除。 –