Skip to content
This repository was archived by the owner on Jan 4, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ThinkPHP/Common/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,21 @@ function S($name,$value='',$options=null) {
// 缓存操作的同时初始化
$type = isset($options['type'])?$options['type']:'';
$cache = Cache::getInstance($type,$options);
$expire = is_numeric($options['expire'])?$options['expire']:NULL; //修复查询缓存无法设置过期时间
}elseif(is_array($name)) { // 缓存初始化
$type = isset($name['type'])?$name['type']:'';
$cache = Cache::getInstance($type,$name);
return $cache;
}elseif(empty($cache)) { // 自动初始化
$cache = Cache::getInstance();
$expire = is_numeric($options)?$options:NULL; //默认快捷缓存设置过期时间
}
if(''=== $value){ // 获取缓存
return $cache->get($name);
}elseif(is_null($value)) { // 删除缓存
return $cache->rm($name);
}else { // 缓存数据
$expire = is_numeric($options)?$options:NULL;
//$expire = is_numeric($options)?$options:NULL; //原始语句
return $cache->set($name, $value, $expire);
}
}
Expand Down Expand Up @@ -768,4 +770,4 @@ function filter_exp(&$value){
if (in_array(strtolower($value),array('exp','or'))){
$value .= ' ';
}
}
}