<?php function cache_data($sql){ $SqlDao = M("User"); $Key = "SqlCache_".md5($sql.time()); $FileData = F($Key,"","./cache/"); if(empty($FileData)){ $data = $SqlDao->query($sql); $FileData['data'] = $data; $FileData['expire'] = time()+3000; #缓存5分钟 F($Key,$FileData,"./cache/"); }else{ if($FileData['expire']<time()){ $data = $SqlDao->query($sql); $FileData['data'] = $data; $FileData['expire'] = time()+3000; #缓存5分钟 F($Key,$FileData,"./cache/"); } } $FileData = F("mp_wechat_token","","./cache/"); return $FileData; }?>