CI_URI::segment PHP Метод

segment() публичный Метод

Fetch URI Segment
См. также: CI_URI::$segments
public segment ( integer $n, mixed $no_result = NULL ) : mixed
$n integer Index
$no_result mixed What to return if the segment index is not found
Результат mixed
    public function segment($n, $no_result = NULL)
    {
        return isset($this->segments[$n]) ? $this->segments[$n] : $no_result;
    }

Usage Example

Пример #1
0
 public function segment($n, $no_result = NULL)
 {
     if (!is_numeric($n)) {
         if (array_key_exists($n, $this->uri_parameters)) {
             $n = $this->uri_parameters[$n];
         } else {
             return $no_result;
         }
     }
     return parent::segment($n, $no_result);
 }