本文整理汇总了PHP中Webapp::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Webapp::init方法的具体用法?PHP Webapp::init怎么用?PHP Webapp::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webapp
的用法示例。
在下文中一共展示了Webapp::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
self::$DOC_ROOT = str_replace(self::$SCRIPT_NAME, '', self::$SCRIPT_FILENAME);
// ex: /var/www
self::$BASE_URL = str_replace(self::$DOC_ROOT, '', self::$BASE_DIR);
// ex: '' or '/mywebsite'
self::$PROTOCOL = empty($_SERVER['HTTPS']) ? 'http' : 'https';
self::$PORT = $_SERVER['SERVER_PORT'];
self::$DISP_PORT = self::$PROTOCOL == 'http' && self::$PORT == 80 || self::$PROTOCOL == 'https' && self::$PORT == 443 ? '' : ":" . self::$PORT;
self::$DOMAIN = $_SERVER['SERVER_NAME'];
self::$FULL_URL = self::$PROTOCOL . "://" . self::$DOMAIN . self::$DISP_PORT . self::$BASE_URL;
$subdomains = explode(".", $_SERVER['HTTP_HOST']);
self::$SUBDOMAIN = array_shift($subdomains);
if (array_key_exists('REQUEST_SCHEME', $_SERVER)) {
self::$REMOTE_HOST = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["SCRIPT_NAME"]);
} else {
self::$REMOTE_HOST = "http://" . $_SERVER["HTTP_HOST"];
}
self::$REMOTE_HOST = str_replace('\\', "/", self::$REMOTE_HOST);
$pathinfo = pathinfo($_SERVER["REQUEST_URI"]);
$parsedInfo = parse_url($_SERVER["REQUEST_URI"]);
//print_r($pathinfo);
//print_r($parsedInfo);
self::$REQUEST_PATHNAME = $parsedInfo['path'];
self::$REQUEST_DIRNAME = $pathinfo['dirname'];
self::$REQUEST_QUERY = isset($parsedInfo['query']) ? $parsedInfo['query'] : "";
self::$REQUEST_FILE_EXT = isset($pathinfo['extension']) ? $pathinfo['extension'] : "";
self::$REQUEST_FILENAME = str_replace("?" . self::$REQUEST_QUERY, "", $pathinfo['basename']);
self::$REQUEST_FILE_EXT = str_replace("?" . self::$REQUEST_QUERY, "", self::$REQUEST_FILE_EXT);
}
}
Webapp::init();