很简单。我该如何转换它:
index.php/person/byAge?age=5 or index.php/person/byAge (with $_POSTed data)
到此:
index.php/person/byAge/5
我正在使用CodeIgniter 2.1.3
答案 0 :(得分:1)
对于您的特定问题,您不需要编辑.htaccess(如果您仍然乐意在网址中包含index.php)。看看Codeigniter uri class here
他们的文档是关于IMO框架的最好的事情,并且会比我更好地解释这一点。
特别注意命令:
$this->uri->segment();
此功能允许您返回网址的特定网段。因此,在您的情况下,您将调用person控制器的byAge方法。拨打$ this-> uri->段(3);将返回5.