Php CodeIgniter URL重写然后获取数据选择?
我想重写URL。我已经删除了Php CodeIgniter URL重写然后获取数据选择?,php,codeigniter,url-rewriting,Php,Codeigniter,Url Rewriting,我想重写URL。我已经删除了index.php。但是 site.com/controller/function?haber=deneme\u haberi 或 site.com/controller/function?cat=teknoloji&haber=deneme\u haberi 我想 site.com/controller/function/deneme\u haberi 或 site.com/controller/function/teknoloji/deneme\u haberi据
index.php
。但是
site.com/controller/function?haber=deneme\u haberi
或
site.com/controller/function?cat=teknoloji&haber=deneme\u haberi
我想
site.com/controller/function/deneme\u haberi
或
site.com/controller/function/teknoloji/deneme\u haberi
据我所知,如果您发送URL,请使用Codeigniter
site.com/controller1/my_function/teknoloji/deneme_haberi,您可以直接将控制器名称后的段映射为函数中的参数:
class Controller1 extends CI_Controller {
[...]
public function my_function( $cat, $haber )
{
echo $cat;
echo $haber;
}
$cat
和$haber
将分别具有第二和第三段值,打印“teknoloji”和“deneme_haberi”。您必须注意,在编写url时,顺序非常重要,因为它是发送参数的顺序