A simple cache example is too simple. First, create the cache directory to write the file functionBZ_cache ($ url, $ cacheName) {global $ cache; global $ QUERY_STRING; here you can name $ filenameca according to your habits // first create the "cache" directory to write the file function BZ_cache ($ url, $ cacheName) {global $ cache; global $ QUERY_STRING; // Here you can name $ filename = "cache/" according to your habits /". $ cacheName. ",". $ QUERY_STRING. ". html "; // here you should also test the file time to see if it has expired // (but this is not done here. Haha! Complete it by yourself !) If (file_exists ($ filename) {readfile ($ filename); return 1; // OK iv send the html page} else {if (! Isset ($ cache) {$ fcontents = join (, file ($ url ."? ". $ QUERY_STRING. "& cache = t"); $ fp = fopen ($ filename, "w"); fwrite ($ fp, $ fcontents); fclose ($ fp); return 0; /// iv to execute the file }}// put the following line of code at the beginning of your php file // if (BZ_cache ("complete url without params ", "AN_IDENTIFIER") exit (); // Remember, this URL must be complete, that is, there must be http ://. However, this parameter is not followed. // There is an example online: http://azerclic.labynet.org/doc.php3 // The first line is // if (BZ_cache (" http://azerclic.labynet.org/doc.php3 "," Doc ") exit (); // you will see the cached file in http://azerclic.labynet.org/cache/ // Thats all // good luck! // I guess there is no problem in WIN32. I still need to consider permission issues in LINUX, because generally there is no write permission.
The http://www.bkjia.com/PHPjc/531724.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531724.htmlTechArticle// first creates a cache directory to write the file function BZ_cache ($ url, $ cacheName) {global $ cache; global $ QUERY_STRING; // Here you can name $ filename = ca...