我正在将CodeIgniter Framework与该.htaccess命令一起用于漂亮的网址".
I am using CodeIgniter Framework with this .htaccess command for "nice urls".
RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico) RewriteRule ^(.*)$ /index.php?$1 [L]所有网址,例如:
- example/admin/xxx/
- 以-> example/index.php?admin/xxx/传递(看起来像CodeIgniter的?/class/method/)
- example/admin/xxx/
- passed as -> example/index.php?admin/xxx/ (look like CodeIgniter's ?/class/method/)
但是问题是:如何通过$_GET参数?例如:
But question is: How can I pass $_GET paramaters? For Example:
- example/admin/xxx/?action=die&time=now
我需要在外部ajax脚本中使用GET参数(例如:基于CODEIGNTER的ElFinder)
I need use GET params od external ajax scripts (f.e.: ElFinder based on CODEIGNTER)
感谢您的建议
我只是在Elfinder中使用POST方法解决了这个问题: Elfinder-请求类型 但是顺便说一句,在codeigniter中使用$ _GET参数标记为?"有了.htaccess,这是不可能的
I solved this problem just using POST method at Elfinder: Elfinder - Request type But btw using $_GET params in codeigniter with mark "?" with this .htaccess, is impossible
推荐答案您是否已阅读 URI分段?
它说明了您如何可以通过您的action和time参数.
It explains how you could pass through your action and time parameters.
例如example/admin/xxx/die/now将与Controller
class Admin extends CI_Controller { public function xxx($action, $time) { // Stuff } }或者,按照@ War10ck的建议,您可以使用 Input 类以获取必需的$_GET参数.例如
Alternatively as @War10ck suggested you could Use the Input class to get the required $_GET parameters. e.g.
class Admin extends CI_Controller { public function xxx() { $action = $this->input->get('action'); $time = $this->input->get('time'); } }更多推荐
通过htaccess + Codeigniter传递GET参数
发布评论