2011-09-29 80 views
0

我的学习之旅MVC一直持续下去,尽管如此,我正在学习很多我永远无法学习的东西。现在我遇到了路由问题。目前我正在使用$ _SERVER [“REQUEST_URI”]并获取控制器和方法以及任何参数。当url格式为http://mysite.com/forum/thread/12/1123时,没有任何问题,但我需要捕获像http://mysite.com/index.php?forum=12&&thread=1123这样的请求。 我已阅读下面的主题中的链接,但无法让我的头在QSA和我,虽然我会更好地问。重写网址:同时提供查询字符串和封锁网址

感谢

mod_rewrite: Check for Custom query string in URL? Rewrite url with query string in htaccess

回答

0

我结束了写东西像以前一样:我重定向使用htaccess的

//No Controller specified in url (The current url is base url like http://example.com/hosanna_framework/) 
if(!isset($_GET['base_url'])){ 
    $url = $config["router"]["default_controller"]; 
} 
//Controller is specified in url 
else{ 
    $url = $_GET['base_url']; 
}