码迷,mamicode.com
首页 > Web开发 > 详细

创建缓存文件(。php)

时间:2015-01-28 17:44:37      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

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)

标签:

原文地址:http://www.cnblogs.com/afei-happy/p/4256354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!