首页 > 代码库 > 创建缓存文件(。php)

创建缓存文件(。php)

public function user_dengji(){
        $this->sdb->select(‘groupid,grouptitle‘);
        $query = $this->sdb->get(‘bbs_usergroups‘);
        $result = $query->result_array();
        $dengji_arr=array();
        foreach($result as $k=>$v){
            $dengji_arr[$v[‘groupid‘]]=$v[‘grouptitle‘];
        }
        $dir = ‘/home/dz55/bbs/www1_only/_bbs_admin/app/cache/user_dengji.php‘;
        if(false === file_exists($dir)||time() - filemtime($dir) > 34*3600){
            if($dengji_arr){
                 return file_put_contents($dir,"<?php\n /*cache create_time:".date(‘Y-m-d H:i:s‘)."*/\n\$dengji = ".var_export($dengji_arr,true).";\n?>");
            }
        }
    }

创建缓存文件(。php)