diff --git a/despote/kernel/Token.php b/despote/kernel/Token.php index 1155da1..cc0317a 100644 --- a/despote/kernel/Token.php +++ b/despote/kernel/Token.php @@ -93,4 +93,24 @@ public function getData($token, $getMethon = true) return $verify_sign == $sign ? $raw_data : false; } + + public function get($token) + { + if (empty($token)) { + return false; + } + list($header, $data, $sign) = explode(',', $token); + + if (empty($header) || empty($data) || empty($sign)) { + return false; + } + + $raw_header = json_decode(base64_decode($header), true); + $raw_data = json_decode(base64_decode($data), true); + $raw_sign = $header . ',' . $data; + + $verify_sign = base64_encode(Utils::encrypt($raw_sign, $this->secret)); + + return $verify_sign == $sign ? ['header' => $raw_header, 'data' => $raw_data] : false; + } } diff --git a/despote/kernel/Tpl.php b/despote/kernel/Tpl.php index 0a603fc..19be754 100644 --- a/despote/kernel/Tpl.php +++ b/despote/kernel/Tpl.php @@ -20,6 +20,7 @@ class Tpl extends Service ///////////// // 模板配置 // //////////// + // 模板所在模块名 public $module; // // 模板内部变量 @@ -47,7 +48,7 @@ public function init() // 加载模板引擎配置 $conf = require PATH_CONF . 'tpl.php'; - $path = PATH_APP . $this->module . DS . 'view' . DS; + $path = PATH_APP . $this->module . DS . 'tpl' . DS; // 使用配置文件初始化属性 $this->tplDir = isset($conf['tplDir']) ? $conf['tplDir'] : $path;