增加token助手函数 用于在页面快速显示令牌

This commit is contained in:
thinkphp
2016-08-15 12:37:10 +08:00
parent 1440277478
commit fd99c07e10
2 changed files with 16 additions and 1 deletions

View File

@@ -1416,7 +1416,9 @@ class Request
{
$type = is_callable($type) ? $type : 'md5';
$token = call_user_func($type, $_SERVER['REQUEST_TIME_FLOAT']);
if ($this->isAjax()) {
header($name . ': ' . $token);
}
Session::set($name, $token);
return $token;
}