我有點棘手,我甚至不確定CI是否被設計爲以這種方式工作。CI靜態D/C/M路由和URI參數
我有一個子域,讓稱之爲test.warren.com
test.warren.com指向一個CI的index.php,這是從在訪問沃倫當被加載在主index.php的分離。 COM。
的test.warren.com的index.php文件已經靜態路由定義,如按照CI評論
/*
* --------------------------------------------------------------------
* DEFAULT CONTROLLER
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
* You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
* WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
* IMPORTANT: If you set the routing here, NO OTHER controller will be
* callable. In essence, this preference limits your application to ONE
* specific controller. Leave the function name blank if you need
* to call functions dynamically via the URI.
*
* Un-comment the $routing array below to use this feature
*
*/
// The directory name, relative to the "controllers" folder. Leave blank
// if your controller is not in a sub-folder within the "controllers" folder
$routing['directory'] = 'subdir';
// The controller class file name. Example: Mycontroller
$routing['controller'] = 'testcontroller';
// The controller function you wish to be called.
$routing['function'] = 'testmethod';
現在,這一切工作的花花公子 - 我有一個方法的網站。沒有別的東西可以訪問只有那種方法。如果我去test.warren.com - 我會得到testmethod()執行的任何內容。現在
,我不能做的部分 - 是傳中URI PARAMS EG:test.warren.com/param1/param2/param3 --- 404
至於我可以調試的原因,這不起作用是因爲當初始化路由器類時,它會嘗試檢查'param1'是否是控制器類或目錄;這符合標準CI配置所期望的。然後404s出來。
我想我可以通過編輯index.php底部加載的主核心/ CodeIgniter.php來解決它;但是我很猶豫,因爲這個CI安裝有多個站點安裝。
CI是v2.0.3
有誰知道這是可能的嗎?
你是否試圖直接在你的域名後面傳遞參數,就像你在例子test.warren.com/param1/param2/param3中提到的那樣? – 2012-02-29 14:26:09