Copy CodeThe code is as follows:
function Createhashdir ($sign)
{
$MD 5 = MD5 ($sign);
if (!is_dir (Mb_cache)) mkdir (Mb_cache);
for ($i =1; $i <=4; $i + +)
{
$dir. = $md 5{$i}. ' /';
if (!is_dir (Mb_cache. $dir))
{
mkdir (Mb_cache. $dir);
}
}
return Mb_cache. $dir;
}
function Setcachefile ($data, $sign = ' a ', $type = ' array ', $id = ')
{
$cacheDir = $this-Createhashdir ($sign);
if (!empty ($data))
{
$id = $id? $id: $sign;
$cacheFile = $cacheDir. $id. PHP ';
$content = $type = = ' array '? Var_export ($data, true): $data;
File_put_contents ($cacheFile, ' ');
}
}
function Getcachefile ($sign = ' a ', $id = ')
{
$cacheDir = $this-Createhashdir ($sign);
$id = $id? $id: $sign;
$cacheFile = $cacheDir. $id. PHP ';
if (Is_file ($cacheFile) && include_once ($cacheFile))
{
return $ $sign;
}
}
function Getcachefilepath ($sign = ' a ', $id = ')
{
$cacheDir = $this-Createhashdir ($sign);
$id = $id? $id: $sign;
Return $cacheDir. $id. PHP ';
}
function Delcachefile ($sign = ' a ')
{
$cacheDir = $this-Createhashdir ($sign);
$id = $id? $id: $sign;
$cacheFile = $cacheDir. $id. PHP ';
$this-Del_file ($cacheFile);
}
http://www.bkjia.com/PHPjc/324377.html www.bkjia.com true http://www.bkjia.com/PHPjc/324377.html techarticle Copy the code as follows: function Createhashdir ($sign) {$MD 5 = MD5 ($sign), if (!is_dir (Mb_cache)) mkdir (Mb_cache); for ($i =1; $i =4;$ i++) {$dir. = $md 5{$i}. ' /'; if (!is_dir (Mb_cache ...