我想檢索字符串使用以下URL方案的參數: www.myapp.com/[String]笨 - 在URL檢索參數,而控制器名稱
有沒有什麼辦法可以做到這一點? *根據我的研究,Codeigniter不接受字符串參數,除非我在URL中包含控制器的名稱:www.myapp.com/[Controller Name]/[String] 但是這並不能解決我的問題: (
我想檢索字符串使用以下URL方案的參數: www.myapp.com/[String]笨 - 在URL檢索參數,而控制器名稱
有沒有什麼辦法可以做到這一點? *根據我的研究,Codeigniter不接受字符串參數,除非我在URL中包含控制器的名稱:www.myapp.com/[Controller Name]/[String] 但是這並不能解決我的問題: (
你說得對,CI要求控制器名稱爲URI,但您可以使用default_controller
在config/routes.php
添加路由規則$routes['(:any)']
= '歡迎/索引'。, remove index.php from Your URL (there're many tutorials and how-to for this), and at last use
URI class at Your
指數()method of
welcome`控制器:
function index(){
var_dump($this->uri->uri_string());
}
你有什麼問題。 ? – Adeel