本文整理匯總了PHP中Uri::baseUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Uri::baseUrl方法的具體用法?PHP Uri::baseUrl怎麽用?PHP Uri::baseUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Uri
的用法示例。
在下文中一共展示了Uri::baseUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Anchor
public static function Anchor($uri, $title = NULL, $attributes = NULL, $protocol = NULL, $escape_title = FALSE)
{
/**
* Create HTML link anchors.
*
* @param string URL or URI string
* @param string link text
* @param array HTML anchor attributes
* @param string non-default protocol, eg: https
* @param boolean option to escape the title that is output
* @return string
*/
if ($protocol === NULL) {
$protocol = getenv('HTTPS') == 'on' ? 'https' : 'http';
}
if (strpos($uri, '#') === 0) {
// This is an id target link, not a URL
$site_url = $uri;
} elseif (strpos($uri, '://') === FALSE) {
$site_url = Uri::baseUrl() . $uri;
} else {
//$attributes['target'] = '_blank';
$site_url = $uri;
}
return '<a href="' . $site_url . '"' . (is_array($attributes) ? htmlAttributes($attributes) : '') . '>' . ($escape_title ? htmlspecialchars($title === NULL ? $site_url : $title, ENT_QUOTES, 'UTF-8', FALSE) : ($title === NULL ? $site_url : $title)) . '</a>';
}
示例2: __construct
function __construct()
{
// generates the user class and determines what we are doing
//session_name($this->config['site']['cookie']);
//session_start();
$this->baseUri = Uri::baseUrl();
$this->set_actions();
if (isset($_GET['logout'])) {
$this->logout();
} elseif (isset($_POST['nonce'])) {
if ($this->nonce('login') == $_POST['nonce']) {
$this->login();
} elseif ($this->nonce('signup') == $_POST['nonce']) {
$this->signup();
} elseif ($this->nonce('change') == $_POST['nonce']) {
$this->change();
} elseif ($this->nonce('edit') == $_POST['nonce']) {
$this->edit();
} else {
$this->fail("Please try again");
}
} elseif (isset($_GET['activate'])) {
$this->activate();
}
}