创建缓存文件(。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?>");
            }
        }
    }

上一篇:(转) cocos2dx 显示中文


下一篇:socket应用(vue、node.js、M站)