這裏是我是如何解決它:
的application/config/routes.php文件
$route['products/(.*)'] = 'products/en/$1';
$route['prodotti/(.*)'] = 'products/it/$1';
應用/控制器/ products.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Products extends CI_Controller {
public function index($lang, $nr)
{
echo 'lang: ', $lang, ' nr: ',$nr;
}
// https://gist.github.com/1096571
function _remap($method)
{
$param_offset = 2;
if (! method_exists($this, $method))
{
$param_offset = 1;
$method = 'index';
}
$params = array_slice($this->uri->rsegment_array(), $param_offset);
call_user_func_array(array($this, $method), $params);
}
}