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