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
}
}