$ _GET和用于PHP的URL重写 [英] $_GET and URL Rewriting for PHP

查看:73
本文介绍了$ _GET和用于PHP的URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

URL重写如何影响PHP的$_GET参数?

How does URL rewriting affect the $_GET parameter for PHP?

说我有一个http://example.com/index.php?p=contact之类的URL,我使用$_GET['p']告诉index.php为联系页面提供服务.如果我使用将URL转换为http://example.com/contact的重写规则,$_GET['p']仍将按预期工作吗?

Say I have a URL like http://example.com/index.php?p=contact and I use $_GET['p'] to tell index.php to serve the contact page. If I use a rewrite rule that converts the URL to http://example.com/contact, will $_GET['p'] still work as expected?

如果可以,您能否详细说明它为什么起作用?如果没有,可以使用什么策略来解决该问题,以便该页面在重写的情况下都可以工作?

If it does, could you elaborate on why it works? If not, what strategies could be used to solve the problem so that the page will work both with and without the rewrite?

推荐答案

是的,它将按预期工作.

Yes, that will work as expected.

这篇关于$ _GET和用于PHP的URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆