File Cache, php file cache. File Cache. php file cache is not much to say. check the code Head. php? Phpdefine (CACHE_EXPIRE, 1800); set the Expiration Time define (CACHE_PATH, $ _ SERVER [DOCUMENT_ROOT]. file cache, php file cache
Read the code.
Head. php
// This method obtains the number of user refreshes. if the user refreshes twice in a row, the latest function refreshTimes () {$ currentUrl = 'http: // 'is displayed ://'. $ _ SERVER ["HTTP_HOST"]. $ _ SERVER ['request _ URI ']; if (isset ($ _ COOKIE ['refreshtimes']) {$ cookArray = explode ("\ t ", $ _ COOKIE ['refreshtimes']); if (isset ($ cookArray [1]) and $ _ SERVER ['request _ time']-(int) $ cookArray [1] <REFRESH_EXPIRE and isset ($ cookArray [0]) and $ cookArray [0] ==$ currentUrl) {setcookie ('refreshtimes ', $ curren TUrl. "\ t ". $ _ SERVER ['request _ time']. "\ t ". (string) (int) $ cookArray [2] + 1), 0, '/'); return (int) $ cookArray [2];} else {setcookie ('refreshtimes', $ currentUrl. "\ t ". $ _ SERVER ['request _ time']. "\ t1", 0, '/'); return 0 ;}} else {setcookie ('refreshtimes', $ currentUrl. "\ t ". $ _ SERVER ['request _ time']. "\ t1", 0, '/'); return 0 ;}$ key = md5 ($ _ SERVER ['request _ URI ']); $ path = CACHE_PATH. $ key; if (is_file ($ path) and filemtime ($ Path) + CACHE_EXPIRE> $ _ SERVER ['request _ time'] and refreshTimes () = 0) {readfile ($ path); exit ();} ob_start ();?>
Foot. php
Test. php
<? Php echo $ title?>
// Others can see the full PHP file cache
View http://www.cnblogs.com/coolid/archive/2012/09/14/2684373.html links
Let's just talk about the code Head. php? Phpdefine ('cache_expire ', 1800); // Set the Expiration Time define ('cache_path', $ _ SERVER ['document_root '].'/...