配置文件名稱網址別名我想寫配置文件的名稱,如www.example.com/profilename
在笨
爲此,我認爲重定向,這不是一個controller
到我的個人資料controller
每名。 我用下面的代碼
$route['(![abc])'] = "profile/$1";
但這似乎並沒有幫助。
配置文件名稱網址別名我想寫配置文件的名稱,如www.example.com/profilename
在笨
爲此,我認爲重定向,這不是一個controller
到我的個人資料controller
每名。 我用下面的代碼
$route['(![abc])'] = "profile/$1";
但這似乎並沒有幫助。
好,
你必須明白,用這種路由幾乎所有的會去您的個人資料控制器。 你可以做的是以下步驟。您必須做的第一件事是將所有路由路由到配置文件控制器,然後將一些路由重置到其他控制器。就像這樣:
*/
Route to profile if there only characters in the request.
When it has special characters in it will be passed.
*/
$route['([a-z]+)/(:any)'] = 'profile/?profile=$1';
// Now make sure other controllers can be called too
$route['other/(:any)'] = 'other/$1';
// And another controller.. etc.
$route['etc/(:any)'] = 'etc/$1';
我並不確切地知道你在做什麼,但它是一個有點壞的方式來使用的路線。只有當你像一個以社區爲中心或社交媒體平臺的時候。我當然明白這一點。
在這種情況下,您必須明確創建一個規則來爲您的控制器進行路由並將其他所有內容重定向到配置文件。
$controllers = array('profile','signup','...');
foreach($controllers as $controller) {
$route[$controller] = $controller."/index";
$route[$controller."/(:any)"] = $controller."/$1";
}
$route['(:any)'] = "profile/$1";