當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CI_Config::site_url方法代碼示例

本文整理匯總了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;
 }
開發者ID:nailsapp,項目名稱:common,代碼行數:59,代碼來源:Config.php

示例2:

 function site_url($uri = '')
 {
     $url = parent::site_url($uri);
     if ($_SERVER['SERVER_PORT'] == 443) {
         $url = str_replace('http://', 'https://', $url);
     }
     return $url;
 }
開發者ID:hqlulu,項目名稱:startbbs,代碼行數:8,代碼來源:MY_Config.php

示例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);
 }
開發者ID:Razican,項目名稱:MegaPublik,代碼行數:10,代碼來源:MP_Config.php

示例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);
 }
開發者ID:orcun-yuksel,項目名稱:DMC,代碼行數:10,代碼來源:MY_Config.php

示例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);
 }
開發者ID:pjmoore92,項目名稱:teamo-webtranslator,代碼行數:11,代碼來源:MY_Config.php

示例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);
 }
開發者ID:sidecia,項目名稱:wiyoitrip,代碼行數:11,代碼來源:MY_Config.php

示例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);
 }
開發者ID:lalcebo,項目名稱:codeigniter-skeleton,代碼行數:16,代碼來源:MY_Config.php

示例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);
     }
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:21,代碼來源:TOC_Config.php

示例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;
 }
開發者ID:ponchov,項目名稱:quizzworld,代碼行數:18,代碼來源:MY_Config.php

示例10: real_site_url

 public function real_site_url($uri)
 {
     return self::url_trim(parent::site_url($uri));
 }
開發者ID:JeffaCubed,項目名稱:OpenVBX,代碼行數:4,代碼來源:MY_Config.php

示例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 */
開發者ID:pravinhirmukhe,項目名稱:punelic,代碼行數:31,代碼來源:constants.php

示例12: real_site_url

 public function real_site_url($uri)
 {
     return parent::site_url($uri);
 }
開發者ID:benrasmusen,項目名稱:OpenVBX,代碼行數:4,代碼來源:MY_Config.php


注:本文中的CI_Config::site_url方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。