CI_URI::slash_segment()

slash_segment($n[, $where = 'trailing'])

Parameters:
  • $n (int) – Segment index number
  • $where (string) – Where to add the slash (‘trailing’ or ‘leading’)
Returns:

Segment value, prepended/suffixed with a forward slash, or a slash if not found

Return type:

string

This method is almost identical to segment(), except it adds a trailing and/or leading slash based on the second parameter. If the parameter is not used, a trailing slash added. Examples:

$this->uri->slash_segment(3);
$this->uri->slash_segment(3, 'leading');
$this->uri->slash_segment(3, 'both');

Returns:

  1. segment/
  2. /segment
  3. /segment/
doc_CodeIgniter
2016-10-15 16:32:03
Comments
Leave a Comment

Please login to continue.