public function display($data = []) { ($viewMode = $this->_view_mode) || ($viewMode = Config::get('project', ['view_mode' => 'Json'])['view_mode']); http_response_code($this->respCode); $view = VFactory::getInstance($viewMode); $view->render($data); }
function checkSign() { // $token = \apache_request_headers()['token']; $headers = apache_request_headers(); // if(isset($headers['token']) && $) return isset($headers['Token']) && $headers['Token'] == Config::get('express')['server_token']; }
/** * 运行时 * @param $rootPath */ public static function run($rootPath = '') { self::$rFramePath = \dirname(__DIR__) . DIRECTORY_SEPARATOR; self::setRootPath($rootPath); // echo self::$rootPath; // echo 'config path:', $configPath, "<br>"; //注册autoLoad函数 \spl_autoload_register(__CLASS__ . '::autoLoader'); Config::load(self::getConfigPath()); $timeZone = Config::get('time_zone', 'Asia/Shanghai'); \date_default_timezone_set($timeZone); $serverMode = Config::get('server_mode'); // var_dump($serverMode); Factory::getInstance($serverMode)->run(); // $control = new \Controller\MainController(); // $control->mainGet(); }
public function mainPut() { $post_id = $type = ''; parse_str($this->_params[0]); // var_dump($this->checkSign()); if (!$post_id || !$type || !$this->checkSign()) { return $this->getError(Error::ERROR_PARAMS); } $express = new ExpressFree(Config::get('express')['free_secret']); $typeArr = $express->getTypeInfo($type); if (!$typeArr) { return $this->getError(Error::ERROR_POST_NOT_SUPPORT); } $key = $typeArr['type'] . '_' . $post_id; $res = $express->query($type, $post_id); $this->cache->putCache($key, $res, $this->cache_type); return ['status' => 0, 'message' => 'ok']; }