2013-03-09 59 views
-1

我想重寫URL。我已經刪除index.php。但;CodeIgniter URL重寫然後獲取數據選擇?

site.com/controller/function?haber=deneme_haberi

site.com/controller/function?cat=teknoloji&haber=deneme_haberi

我想;

site.com/controller/function/deneme_haberi

site.com/controller/function/teknoloji/deneme_haberi

回答

0

據我所知,在笨,如果您發送的網址

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時,順序非常重要,因爲它將是您發​​送參數的順序。