本文整理汇总了PHP中CI_Config::site_url方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Config::site_url方法的具体用法?PHP CI_Config::site_url怎么用?PHP CI_Config::site_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Config
的用法示例。
在下文中一共展示了CI_Config::site_url方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: site_url
public function site_url($uri = '', $force_secure = FALSE)
{
// Prepare the URI as normal
$_uri = parent::site_url($uri);
// --------------------------------------------------------------------------
// If forcing secure just return now
if ($force_secure) {
return preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $_uri);
}
// --------------------------------------------------------------------------
// If SSL routing is enabled then parse the URL
if (APP_SSL_ROUTING) {
$_prefix = 'https://';
$this->load('routes_ssl');
// --------------------------------------------------------------------------
// Fetch SSL routes
if (!$this->routes_ssl) {
$this->routes_ssl = $this->item('routes_ssl');
if (!$this->routes_ssl) {
$this->routes_ssl = array();
}
}
// --------------------------------------------------------------------------
// Analyse target URL, if it matches a route then change it to be an https URL
$_is_secure_route = FALSE;
foreach ($this->routes_ssl as $route) {
// Swap out the pseudo regex's
$route = str_replace(':any', '.*', $route);
$route = str_replace(':num', '[0-9]*', $route);
// See if any of the routes match, if they do halt the loop.
// We need to do an optional prefix for the hosts
if (BASE_URL !== SECURE_BASE_URL) {
$_pattern = '#^(' . preg_quote(BASE_URL, '#') . '|' . preg_quote(SECURE_BASE_URL, '#') . ')?' . $route . '#';
} else {
$_pattern = '#^(' . preg_quote(BASE_URL, '#') . ')?' . $route . '#';
}
if (preg_match($_pattern, $_uri)) {
$_is_secure_route = TRUE;
break;
}
}
// --------------------------------------------------------------------------
// If there was a match replace http:// with https://; also replace any
// calls for anything to the assets folder or the favicon (so secure content
// is shown).
// HTTPS is considered on if the domain matches that given in SECURE_BASE_URL
// or if the page is being served through HTTPS
if (isset($_SERVER)) {
$_page_is_secure = page_is_secure();
if ($_is_secure_route || $_page_is_secure && preg_match('#^' . BASE_URL . 'assets.*#', $_uri) || $_page_is_secure && preg_match('#^' . NAILS_ASSETS_URL . '.*#', $_uri) || $_page_is_secure && preg_match('#^' . BASE_URL . 'favicon\\.ico#', $_uri)) {
// SSL is off and there was a match, turn SSL on
$_uri = preg_replace('#^' . BASE_URL . '#', SECURE_BASE_URL, $_uri);
}
}
}
// --------------------------------------------------------------------------
// Spit back our result
return $_uri;
}
示例2:
function site_url($uri = '')
{
$url = parent::site_url($uri);
if ($_SERVER['SERVER_PORT'] == 443) {
$url = str_replace('http://', 'https://', $url);
}
return $url;
}
示例3: implode
function site_url($uri = '')
{
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (class_exists('CI_Controller')) {
$uri = get_instance()->lang->localized($uri);
}
return parent::site_url($uri);
}
示例4: site_url
public function site_url($uri = '', $protocol = NULL)
{
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (function_exists('get_instance')) {
$uri = get_instance()->lang->localized($uri);
}
return parent::site_url($uri, $protocol);
}
示例5: implode
function site_url($uri = '')
{
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (function_exists('get_instance')) {
$CI =& get_instance();
$uri = $CI->lang->localized($uri);
}
return parent::site_url($uri);
}
示例6: implode
function site_url($uri = '', $protocol = NULL)
{
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (class_exists('CI_Controller')) {
$CI =& get_instance();
$uri = $CI->lang->localized($uri);
}
return parent::site_url($uri);
}
示例7: site_url
/**
* @param string $uri
* @param null $protocol
* @return string
*/
public function site_url($uri = '', $protocol = NULL)
{
global $LANG;
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (class_exists('CI_Controller')) {
$uri = $LANG->localized($uri);
}
return parent::site_url($uri);
}
示例8: site_url
/**
* Site URL
* Returns base_url . index_page [. uri_string]
*
* @param mixed the URI string or an array of segments
* @return string
*/
public function site_url($uri = '')
{
//get ci instance
$ci = get_instance();
//check whether sef service is installed
if ($ci->service->is_installed('sef')) {
//get service
$sef = $ci->service->get_service('sef');
//process the search friendly url
return $sef->site_url($uri);
} else {
return parent::site_url($uri);
}
}
示例9: implode
function site_url($uri = '')
{
if (is_array($uri)) {
$uri = implode('/', $uri);
}
if (class_exists('CI_Controller')) {
$CI =& get_instance();
//echo parent::site_url(); exit;
//--------------------if($CI->config->item('language') == 'english') return parent::site_url($uri);
$uri = $CI->lang->localized($uri);
//echo $uri; exit;
}
//echo $uri; exit;
$site_url = parent::site_url($uri);
$site_url = rtrim($site_url, '/');
$site_url .= "/";
return $site_url;
}
示例10: real_site_url
public function real_site_url($uri)
{
return self::url_trim(parent::site_url($uri));
}
示例11: fopen
| always be used to set the mode correctly.
|
*/
define('FILE_READ_MODE', 0644);
define('FILE_WRITE_MODE', 0666);
define('DIR_READ_MODE', 0755);
define('DIR_WRITE_MODE', 0777);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
define('FOPEN_READ', 'rb');
define('FOPEN_READ_WRITE', 'r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb');
// truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b');
// truncates existing file data, use with care
define('FOPEN_WRITE_CREATE', 'ab');
define('FOPEN_READ_WRITE_CREATE', 'a+b');
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
require FCPATH . "system/core/Config.php";
$url = new CI_Config();
define("BASEURL", $url->base_url());
define("SITEURL", $url->site_url());
/* End of file constants.php */
/* Location: ./application/config/constants.php */
示例12: real_site_url
public function real_site_url($uri)
{
return parent::site_url($uri);
}