diff --git a/library/think/Request.php b/library/think/Request.php index 9112beed..da3194fa 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1409,13 +1409,13 @@ class Request * 生成请求令牌 * @access public * @param string $name 令牌名称 - * @param string $type 令牌生成类型 + * @param string|array $type 令牌生成方法 * @return string */ public function token($name = '__token__', $type = 'md5') { $type = is_callable($type) ? $type : 'md5'; - $token = $type($_SERVER['REQUEST_TIME_FLOAT']); + $token = call_user_func($type, $_SERVER['REQUEST_TIME_FLOAT']); Session::set($name, $token); return $token;