1
我只是想加载控制器,而不是调用基于URI的函数,以便我可以基于以下段生成页面。 如何更改默认行为来执行此操作?例如。CodeIgniter - 关闭控制器函数调用?
example.com/class/function/ID >>> example.com/class/ID/ID
我以为所有我需要做的是在config.php中添加:
$route['find/(:any)/(:any)'] = "find/$1/$2";
但是这给了我一个404
example.com/find/item/location
class Find extends CI_Controller {
private $s1;
private $s2;
function __construct()
{
parent::__construct();
}
function index()
{
$this->s1 = $this->uri->segment(2);
$this->s2 = $this->uri->segment(3);
$this->makePage();
}
function makePage()
{
echo 'Page about ' . $this->s1 . 'in ' . $this->s2;
//Get Data ($s1 & $s2)
//Load View
}
}