Assumendo che il parametro sarà, alla fine, sempre:
$segs = $this->uri->segment_array();
echo end($segs);
EDIT: Per l'chiarire altri elementi essenziali. In primo luogo è necessario il configurare il application/config/routes.php
:
$route['Youruri-(:any)/(:num)'] = "yourcontroller/yourfunction/$1/$2";
$route['Youruri-(:any)'] = "yourcontroller/yourfunction/$1";
Nel controllore application/controllers/yourcontroller.php
è necessario definire una funzione:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Yourcontroller extends CI_Controller {
function yourfunction($brand = null, $page = null) {
// http://www.yoursite.com/Youruri-Microsoft
// or http://www.yoursite.com/yourcontroller/yourfunction/Microsoft
// do some stuff for get products of this $brand (Microsoft)
if($page != null) {
// http://www.yoursite.com/Youruri-Intel/2
// or http://www.yoursite.com/yourcontroller/yourfunction/Intel/2
// do some other stuff get products of this $brand (Intel) of $page (2)
}
}
}
Potrebbe essere necessario configurare i percorsi. – user4419336