本文整理汇总了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;
}