Home >Database >Mysql Tutorial >缓存PHP页面代码 可减轻CPU和MYSQL负担_MySQL

缓存PHP页面代码 可减轻CPU和MYSQL负担_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:59:38821browse

使用前,先在根目录创建“cache”文件夹,然后运行1.php,第一次运行和第二次运行速度差异很大。
欢迎熟悉PHP的朋友使用和提意见。

使用方法:(请保存为1.php) CODE:

include('arrcache.php');
$cache = new ArrCache('cache',5,'txt');
for ($i=0;$i{
echo $i;
sleep(1);
}
$cache->endCache();
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn