且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP缓存MySQL查询结果的最简单方法是?

更新时间:2022-02-15 09:23:36

缓存PHP数组非常简单:

Caching a PHP array is pretty easy:

file_put_contents($path, '<?php return '.var_export($my_array,true).';?>');

然后您可以将其读出:

if (file_exists($path)) $my_array = include($path);

您可能还想查看ADOdb ,它提供了缓存内部.

You might also want to look into ADOdb, which provides caching internally.