2
如何在CodeIgniter中動態獲取/ user/bob user/martin之類的URL?CodeIgniter中的動態URL?
如何在CodeIgniter中動態獲取/ user/bob user/martin之類的URL?CodeIgniter中的動態URL?
您需要爲application/config/routes.php中的控制器設置自定義路由,例如,
$route['user/(:any)'] = "user/user_controller_method/$1";
你應該使用
$route['user/(:any)'] = "user/user_controller_method/$1";
詹姆斯建議,然後定義用戶控制器上的funcion:
function user_controller_method($username) {
// ... $username should be the url param
}
http://codeigniter.com/user_guide/general/ routing.html – fabrik 2010-09-13 11:28:45