Codeigniter,使用查询字符串从基于段的 URL 获取变量
我已经从我的url中删除了index.php,但现在我需要从url中获取一些变量,CI解决方案是更新config.php,
$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
当我在url中使用index.php时,这个工作完美,但我需要它没有index.php
这是我的httacess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA
有什么解决方案吗? , 谢谢
i've removed the index.php from my url but now i need to get some variable from the url , the CI solution is update the config.php
$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
this work perfectly when i use the index.php in the url , but i need it without index.php
this is my httacess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA
any solution ? , thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 CI 中遇到了同样的问题,所以我编写了这个函数来从 $_SERVER['REQUEST_URI'] 变量中获取查询字符串并提取它们。
该函数在我的自定义主控制器的 __construct() 中调用。
中的以下行
您可以修改To
并查看它是否适合您。
I had the same problem in CI, so I wrote this function to get the query strings from the $_SERVER['REQUEST_URI'] variable and extract them.
This function is called at my custom main controller's __construct().
You can modify the following line from
To
And see if it works for you.
您是否查看过 Elliot Haughin 的 Facebook 库 CodeIgniter?它可能会提供一些有关在 Facebook 上使用 CI 的见解。
http://www.haughin.com/code/facebook/
Have you looked at Elliot Haughin's Facebook library for CodeIgniter? It might provide some insights into using CI with Facebook.
http://www.haughin.com/code/facebook/