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


PHP URI::_filter_uri方法代碼示例

本文整理匯總了PHP中URI::_filter_uri方法的典型用法代碼示例。如果您正苦於以下問題:PHP URI::_filter_uri方法的具體用法?PHP URI::_filter_uri怎麽用?PHP URI::_filter_uri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在URI的用法示例。


在下文中一共展示了URI::_filter_uri方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

 /**
  * Set the route mapping
  *
  * This function determines what should be served based on the URI request,
  * as well as any "routes" that have been set in the routing config file.
  *
  * @access	private
  * @return	void
  */
 function _set_routing()
 {
     // Are query strings enabled in the config file?  Normally CI doesn't utilize query strings
     // since URI segments are more search-engine friendly, but they can optionally be used.
     // If this feature is enabled, we will gather the directory/class/method a little differently
     $segments = array();
     if ($this->config['enable_query_strings'] === TRUE and isset($_GET[$this->config['controller_trigger']])) {
         if (isset($_GET[$this->config['ns_trigger']]) and isset($this->routes[trim($this->uri->_filter_uri($_GET[$this->config['ns_trigger']]))]['ns'])) {
             $this->set_ns($this->routes[trim($this->uri->_filter_uri($_GET[$this->config['ns_trigger']]))]['ns']);
         }
         if (isset($_GET[$this->config['controller_trigger']])) {
             $this->set_class($seg = trim($this->uri->_filter_uri($_GET[$this->config['controller_trigger']])));
             $segments[] = $seg;
         }
         if (isset($_GET[$this->config['function_trigger']])) {
             $this->set_method(trim($this->uri->_filter_uri($_GET[$this->config['function_trigger']])));
             $segments[] = $this->fetch_method();
         }
     }
     // Set the default controller so we can display it in the event
     // the URI doesn't correlated to a valid controller.
     $this->default_controller = (!isset($this->routes['default_controller']) or $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
     // Were there any query string segments?  If so, we'll validate them and bail out since we're done.
     if (count($segments) > 0) {
         return $this->_validate_request($segments);
     }
     // Fetch the complete URI string
     $this->uri->_fetch_uri_string();
     // Is there a URI string? If not, the default controller specified in the "routes" file will be shown.
     if ($this->uri->uri_string == '') {
         return $this->_set_default_controller();
     }
     // Do we need to remove the URL suffix?
     $this->uri->_remove_url_suffix();
     // Compile the segments into an array
     $this->uri->_explode_segments();
     // Parse any custom routing that may exist
     $this->_parse_routes();
     // Re-index the segment array so that it starts with 1 rather than 0
     $this->uri->_reindex_segments();
 }
開發者ID:jackxiaoxiaoxun,項目名稱:emmvc,代碼行數:50,代碼來源:Router.php


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