0
我遇到了處理$ _GET的CI問題,並找到了解決這個問題的方法。
問題是,你能看到這裏的安全問題嗎?
我有我的網址一樣
/contacts
/company/info
所有的方式和對笨我的默認控制器被稱爲指數
我可以讓CI只要有$_GET
表現爲我按照class/function/default_controller
。
這兩個網址的工作:
// class + function + default controller = ok
/class/function/index?var1=this&var2=that
// class + default controller = ok
/class/index?var1=this&var2=that
的事情是我想這些也工作
// class without function nor default controller = NOT OK
/class?var1=this&var2=that
// class + function without default controller = NOT OK
/class/function?var1=this&var2=that
我的解決辦法是在$_SERVER['REQUEST_URI']
一點正則表達式。
我不是專家的正則表達式,所以,你可以在這裏看到一個可能的安全問題?
/*
|---------------------------------------------------------------
| MAKE CODEIGNITER BEHAVE ON _GETS!
|---------------------------------------------------------------
|
| CI doesn't like to play ball with /contacts?a=23 and fails on several ocasions
| This forces the first ? or & to be replaced by /index/ that is the default controller
|
*/
$_SERVER['REQUEST_URI'] = preg_replace('/\?|\&/', '/index/', $_SERVER['REQUEST_URI'], 1);
謝謝。
感謝您的意見! ;) – Frankie 2010-07-03 02:08:01