| 12345678910111213141516171819202122232425262728 |
- <?php
- namespace Tools;
- class Router
- {
- private $rootPath;
- private $rootUrl;
- public function __construct()
- {
- $siteUrl = \Entity\Config::getConfig(null, "siteUrl");
- if ($siteUrl != $_SERVER["HTTP_HOST"])
- {
- header("location: http://{$siteUrl}{$_SERVER['REQUEST_URI']}");
- die;
- }
- $pos = strrpos($_SERVER["SCRIPT_NAME"], "/");
- $relativePath = (($pos === FALSE) ? "" : substr($_SERVER["SCRIPT_NAME"], 0, $pos));
- $this->rootPath = $_SERVER["DOCUMENT_ROOT"] . $relativePath . "/";
- $this->rootUrl = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["HTTP_HOST"] . $relativePath ."/";
- }
- public function init($context)
- {
- }
- }
|