本文整理匯總了PHP中I2CE::getProtocol方法的典型用法代碼示例。如果您正苦於以下問題:PHP I2CE::getProtocol方法的具體用法?PHP I2CE::getProtocol怎麽用?PHP I2CE::getProtocol使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類I2CE
的用法示例。
在下文中一共展示了I2CE::getProtocol方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setBase
protected function setBase()
{
$head = $this->getElementByTagName('head', 0);
if (!$head instanceof DOMNode) {
return;
}
$script = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/"));
$site_url = I2CE::getProtocol() . '://' . $_SERVER['HTTP_HOST'] . $script . '/';
$base = $this->createElement('base', array('href' => $site_url));
$head->insertBefore($base, $head->firstChild);
}
示例2: redirect
/**
* Send the redirect header with the given URL.
*
* @param string $url
*/
public function redirect($url)
{
if (!array_key_exists('HTTP_HOST', $_SERVER)) {
return;
}
if ($this->isGet() && !preg_match('/login/', $_SERVER['REQUEST_URI'])) {
$_SESSION['referal'] = I2CE::getProtocol() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
if (preg_match('/^[a-zA-Z]+:\\/\\//', $url) || $url[0] == '/') {
//an absolute url
//do nothing;
} else {
$url = $this->getAccessedBaseURL() . $url;
}
header("Location: " . $url);
}
示例3: getAccessedBaseURL
/**
* Returns the base url from which the site was accessed. If no
* .htaccess is used, ths will include the index.php. If rewrites
* are used (via .htacces) this will no include the
* index.php. Point is... this is the base url from which the site
* was accessed, no questions asked. This of course assumes that
* you are now accessing the site via the command line
*
*@return string
*/
public static function getAccessedBaseURL($include_http = true)
{
$script = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/"));
if ($include_http) {
if (array_key_exists('HTTP_HOST', $_SERVER)) {
$site_url = I2CE::getProtocol() . '://' . $_SERVER['HTTP_HOST'] . $script . '/';
} else {
$site_url = 'http://localhost/';
}
} else {
$site_url = $script . '/';
}
if (!self::rewrittenURLs()) {
$site_url = $site_url . 'index.php/';
} else {
if ($_SERVER['SCRIPT_NAME'] . '/update.php' == $_SERVER['PHP_SELF']) {
$site_url = $site_url . 'index.php/';
}
}
return $site_url;
}