mod_rewrite 规则与 get 方法一起使用

发布于 2024-08-31 04:11:41 字数 488 浏览 5 评论 0原文

我正在使用这个规则:

RewriteRule    ^(.*)$ public/$1    [L]

并且在公共文件夹中我使用:

$url = $_GET['url'];

当我尝试使用斜杠访问网址上的某些内容时,或者它工作正常,我得到:

/cities/display/45   =>   Array ( [0] => cities [1] => display [2] => 45)   

但是当我尝试提交表单时,我无法访问数据:

/cities/?field1=value1&field2=value2   =>   Array ( [0] => cities)

我该如何解决这个问题?我需要一个还可以获取表单提交值的规则

谢谢

I'm using this rule:

RewriteRule    ^(.*)$ public/$1    [L]

and in public folder I use:

$url = $_GET['url'];

when I try to acess something on url using slash or it works fine and I get:

/cities/display/45   =>   Array ( [0] => cities [1] => display [2] => 45)   

But when I try to submit a form, i'm not able to acces the data:

/cities/?field1=value1&field2=value2   =>   Array ( [0] => cities)

How can I solve this? I need a rule that also gets form's submited values

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼中杀气 2024-09-07 04:11:41

看起来像 PHP 代码...

为什么不通过 $_GET['field1'] 或 $_REQUEST['field1'] 访问表单提交的值?

Looks like PHP-Code...

Why aren't you accessing the form submitted values via $_GET['field1'] or $_REQUEST['field1'] ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文