A simple cache example (but a little too simple!) )
?//create "cache" directory first to write files
function Bz_cache ($url, $cacheName)??
{
Global $cache;??
Global $QUERY _string;
Can you name it in your own custom??
$filename = "cache/". $cacheName. "," $QUERY _string. ". HTML ";
Here you should also test the file time to see if it expires
(but it's not done here.) Oh! Do It yourself! )
????? if (File_exists (??? $filename))??
???????? {??
???????? ReadFile ($filename);
??????? return 1; ///?? Ok i ' v 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;??? ///?? I ' V to execute the file??
??????????}
???????}
}??
Put the following line of code at the very beginning of your PHP file
//?? if (Bz_cache ("COMPLETE URL without PARAMS", "An_identifier")??? Exit ();??
Remember, this URL is to be complete, that is, there is a http://in front. But not after the argument.
There is an example on the Web: http://azerclic.labynet.org/doc.PHP3
The first line is??
if (Bz_cache ("Http://azerclic.labynet.org/doc.PHP3", "Doc"))??? Exit ();??
You'll see cached files in http://azerclic.labynet.org/cache/
So ' s all??
Good luck!
I estimate that under the WIN32 no problem, under Linux also need to consider permission issues, because generally do not write permission