<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # URI 類 URI 類用于幫助你從 URI 字符串中獲取信息,如果你使用 URI 路由, 你也可以從路由后的 URI 中獲取信息。 注解 該類由系統自己加載,無需手工加載。 * [類參考](http://codeigniter.org.cn/user_guide/libraries/uri.html#id1) ## [類參考](http://codeigniter.org.cn/user_guide/libraries/uri.html#id2) classCI_URI segment($n[,?$no_result = NULL]) 參數: * **$n**?(int) -- Segment index number * **$no_result**?(mixed) -- What to return if the searched segment is not found 返回: Segment value or $no_result value if not found 返回類型: mixed 用于從 URI 中獲取指定段。參數 n 為你希望獲取的段序號,URI 的段從左到右進行編號。 例如,如果你的完整 URL 是這樣的: ~~~ http://example.com/index.php/news/local/metro/crime_is_up ~~~ 那么你的每個分段如下: ~~~ #. news #. local #. metro #. crime_is_up ~~~ 第二個參數為可選的,默認為 NULL ,它用于設置當所請求的段不存在時的返回值。 例如,如下代碼在失敗時將返回數字 0 ~~~ $product_id = $this->uri->segment(3, 0); ~~~ 它可以避免你寫出類似于下面這樣的代碼: ~~~ if ($this->uri->segment(3) === FALSE) { $product_id = 0; } else { $product_id = $this->uri->segment(3); } ~~~ rsegment($n[,?$no_result = NULL]) 參數: * **$n**?(int) -- Segment index number * **$no_result**?(mixed) -- What to return if the searched segment is not found 返回: Routed segment value or $no_result value if not found 返回類型: mixed 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?segment()?類似, 只是它用于從路由后的 URI 中獲取指定段。 slash_segment($n[,?$where = 'trailing']) 參數: * **$n**?(int) -- Segment index number * **$where**?(string) -- Where to add the slash ('trailing' or 'leading') 返回: Segment value, prepended/suffixed with a forward slash, or a slash if not found 返回類型: string 該方法和?segment()?類似,只是它會根據第二個參數在返回結果的前面或/和后面添加斜線。 如果第二個參數未設置,斜線會添加到后面。例如: ~~~ $this->uri->slash_segment(3); $this->uri->slash_segment(3, 'leading'); $this->uri->slash_segment(3, 'both'); ~~~ 返回結果: 1. segment/ 2. /segment 3. /segment/ slash_rsegment($n[,?$where = 'trailing']) 參數: * **$n**?(int) -- Segment index number * **$where**?(string) -- Where to add the slash ('trailing' or 'leading') 返回: Routed segment value, prepended/suffixed with a forward slash, or a slash if not found 返回類型: string 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?slash_segment()?類似, 只是它用于從路由后的 URI 返回結果的前面或/和后面添加斜線。 uri_to_assoc([$n = 3[,?$default = array()]]) 參數: * **$n**?(int) -- Segment index number * **$default**?(array) -- Default values 返回: Associative URI segments array 返回類型: array 該方法用于將 URI 的段轉換為一個包含鍵值對的關聯數組。如下 URI: ~~~ index.php/user/search/name/joe/location/UK/gender/male ~~~ 使用這個方法你可以將 URI 轉為如下的數組原型: ~~~ [array] ( 'name' => 'joe' 'location' => 'UK' 'gender' => 'male' ) ~~~ 你可以通過第一個參數設置一個位移,默認值為 3 ,這是因為你的 URI 的前兩段通常都是控制器和方法。 例如: ~~~ $array = $this->uri->uri_to_assoc(3); echo $array['name']; ~~~ 第二個參數用于設置默認的鍵名,這樣即使 URI 中缺少某個鍵名,也能保證返回的數組中包含該索引。 例如: ~~~ $default = array('name', 'gender', 'location', 'type', 'sort'); $array = $this->uri->uri_to_assoc(3, $default); ~~~ 如果某個你設置的默認鍵名在 URI 中不存在,數組中的該索引值將設置為 NULL 。 另外,如果 URI 中的某個鍵沒有相應的值與之對應(例如 URI 的段數為奇數), 數組中的該索引值也將設置為 NULL 。 ruri_to_assoc([$n = 3[,?$default = array()]]) 參數: * **$n**?(int) -- Segment index number * **$default**?(array) -- Default values 返回: Associative routed URI segments array 返回類型: array 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?uri_to_assoc()?類似, 只是它用于將路由后的 URI 的段轉換為一個包含鍵值對的關聯數組。 assoc_to_uri($array) 參數: * **$array**?(array) -- Input array of key/value pairs 返回: URI string 返回類型: string 根據輸入的關聯數組生成一個 URI 字符串,數組的鍵將包含在 URI 的字符串中。例如: ~~~ $array = array('product' => 'shoes', 'size' => 'large', 'color' => 'red'); $str = $this->uri->assoc_to_uri($array); // Produces: product/shoes/size/large/color/red ~~~ uri_string() 返回: URI string 返回類型: string 返回一個相對的 URI 字符串,例如,如果你的完整 URL 為: ~~~ http://example.com/index.php/news/local/345 ~~~ 該方法返回: ~~~ news/local/345 ~~~ ruri_string() 返回: Routed URI string 返回類型: string 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?uri_string()?類似, 只是它用于返回路由后的 URI 。 total_segments() 返回: Count of URI segments 返回類型: int 返回 URI 的總段數。 total_rsegments() 返回: Count of routed URI segments 返回類型: int 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?total_segments()?類似, 只是它用于返回路由后的 URI 的總段數。 segment_array() 返回: URI segments array 返回類型: array 返回 URI 所有的段組成的數組。例如: ~~~ $segs = $this->uri->segment_array(); foreach ($segs as $segment) { echo $segment; echo '<br />'; } ~~~ rsegment_array() 返回: Routed URI segments array 返回類型: array 當你使用 CodeIgniter 的?[URI 路由](http://codeigniter.org.cn/user_guide/general/routing.html)?功能時,該方法和?segment_array()?類似, 只是它用于返回路由后的 URI 的所有的段組成的數組。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看