private function __construct() { $this->env = Env::getInstance(); //初始化数据 $this->queryData()->postData()->fileData()->parseReq(); $this->isAjax = $this->isAjax(); $this->isXhr = $this->isAjax; }
/** * 应用分组信息 * @return self */ public function applyGroup() { $url = $this->env->getPathinfo(); $url = trim($url, '/'); if (!$this->_routerGroup) { return false; } //提取第一段为分组信息 $urls = explode('/', $url); $gstr = array_shift($urls); $this->vitex = Vitex::getInstance(); foreach ($this->_routerGroup as $p => $g) { if ($p != $gstr) { //当绑定分组为 / 时此处有bug continue; } $this->groupurl = $p; $this->parseGroupMethod($g); break; } return $this; }
public function __construct() { $this->env = Env::getInstance(); $this->setRegexp(['digit' => '[0-9]+', 'alpha' => '[a-zA-Z]+', 'alphadigit' => '[0-9a-zA-Z]+', 'float' => '[0-9]+\\.{1}[0-9]+']); }
private function __construct() { //注册加载 加载器 require __DIR__ . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . "Loader.php"; $this->loader = new Loader(); $this->loader->addNamespace("\\Vitex", __DIR__); $this->loader->register(); //init app $this->settings = $this->defaultSetting; //初始化各种变量 $this->env = Core\Env::getInstance(); $this->route = new Core\Route(); //初始化 request response $this->req = Core\Request::getInstance(); $this->res = Core\Response::getInstance(); $this->res->url = function ($url, $params = []) { return $this->url($url, $params); }; //view视图 $this->view = null; //日志 $this->log = new Log(); //添加第一个中间件,他总是最后一个执行 $this->using(new Middleware\MethodOverride()); date_default_timezone_set('Asia/Shanghai'); }