mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进request类的token方法
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user