2015-02-06 28 views

回答

1

嘗試在routes.php文件驗證碼:

$route['hello/(:any)'] = "detail/hello/$1/$2"; 

or 

$route['hello/(:num)/(:any)'] = "detail/hello/$1/$2"; 
1
application/config/routes.php

,改寫這樣的網址:

$route['news/hello/(:num)/(:any)'] = "news/detail/hello/$1/$2";

我不知道的news部分,如果是除上面所描述線控制器文件夾的子文件夾就可以了,如果CI在安裝news子文件夾,那麼請刪除news部分來自側。

確保從hello方法是這樣接受的參數值:

public function hello($id = null, $slug = null)

+0

我的你好函數是這樣的\t函數hello($ id) \t { \t \t \t \t $ \t這 - >負載>模型( 'news_model'); \t \t $ data ['news'] = $ this-> news_model-> readmore($ id); \t \t \t \t $ data ['footer_recent'] = $ this-> news_model-> get_footer_recent(); \t \t $ data ['random_post'] = $ this-> news_model-> get_randompost(); \t \t $ this-> load-> view('header'); \t \t \t $ this-> load-> view('readmore',$ data); \t \t $ this-> load-> view('footer'); \t \t \t} – Hirdesh 2015-02-06 07:29:38

+0

從「愛爾蘭 - 徒步旅行 - 古代遺蹟 - 被霧朦朧的部分來了嗎? – 2015-02-06 07:30:57

+0

我們的答案不起作用 – Hirdesh 2015-02-06 07:31:34