内核代码升级
This commit is contained in:
@@ -18,6 +18,8 @@ use think\Config;
|
||||
use think\Cookie;
|
||||
use think\Db;
|
||||
use think\Debug;
|
||||
use think\exception\HttpException;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
use think\Log;
|
||||
@@ -345,9 +347,10 @@ if (!function_exists('cache')) {
|
||||
* @param mixed $name 缓存名称,如果为数组表示进行缓存设置
|
||||
* @param mixed $value 缓存值
|
||||
* @param mixed $options 缓存参数
|
||||
* @param string $tag 缓存标签
|
||||
* @return mixed
|
||||
*/
|
||||
function cache($name, $value = '', $options = null)
|
||||
function cache($name, $value = '', $options = null, $tag = null)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
// 缓存操作的同时初始化
|
||||
@@ -369,7 +372,11 @@ if (!function_exists('cache')) {
|
||||
} else {
|
||||
$expire = is_numeric($options) ? $options : null; //默认快捷缓存设置过期时间
|
||||
}
|
||||
return Cache::set($name, $value, $expire);
|
||||
if (is_null($tag)) {
|
||||
return Cache::set($name, $value, $expire);
|
||||
} else {
|
||||
return Cache::tag($tag)->set($name, $value, $expire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -505,9 +512,9 @@ if (!function_exists('abort')) {
|
||||
function abort($code, $message = null, $header = [])
|
||||
{
|
||||
if ($code instanceof Response) {
|
||||
throw new \think\exception\HttpResponseException($code);
|
||||
throw new HttpResponseException($code);
|
||||
} else {
|
||||
throw new \think\exception\HttpException($code, $message, null, $header);
|
||||
throw new HttpException($code, $message, null, $header);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +527,7 @@ if (!function_exists('halt')) {
|
||||
function halt($var)
|
||||
{
|
||||
dump($var);
|
||||
throw new \think\exception\HttpResponseException(new Response);
|
||||
throw new HttpResponseException(new Response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,6 +536,7 @@ if (!function_exists('token')) {
|
||||
* 生成表单令牌
|
||||
* @param string $name 令牌名称
|
||||
* @param mixed $type 令牌生成方法
|
||||
* @return string
|
||||
*/
|
||||
function token($name = '__token__', $type = 'md5')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user