把表记录生成数组

in 程序开发

以下是来自phpcms2008程序global.func.php文件部分函数,仅供参考:

function cache_read($file, $path = '', $iscachevar = 0)
{
 if(!$path) $path = CACHE_PATH;
 $cachefile = $path.$file;
 if($iscachevar)
 {
  global $TEMP;
  $key = 'cache_'.substr($file, 0, -4);
  return isset($TEMP[$key]) ? $TEMP[$key] : $TEMP[$key] = @include $cachefile;
 }
 return @include $cachefile;
}

function cache_write($file, $array, $path = '')
{
 if(!is_array($array)) return false;
 $array = "<?php\nreturn ".var_export($array, true).";\n?>";
 $cachefile = ($path ? $path : CACHE_PATH).$file;
 $strlen = file_put_contents($cachefile, $array);
 @chmod($cachefile, 0777);
 return $strlen;
}

function cache_delete($file, $path = '')
{
 $cachefile = ($path ? $path : CACHE_PATH).$file;
 return @unlink($cachefile);
}

0 Comments

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>