如何更改页面网址?
如何获取页面url,然后根据地址栏中的查询结果重命名url?
抱歉,描述很简短。
我如何更改页面网址(使用 exmple.php?id=2
页面,但网址只是名称 www.something.org/zzz< /code> 其中 zzz 是与 id 关联的名称值,没有任何扩展名,扩展名将根据查询而改变)?
How to get page url and then rename the url based on query result at a time in the address bar ?
sorry for short description..
How can I change page url (working with a exmple.php?id=2
page but the url would be only the name www.something.org/zzz
where zzz is the value of name associated with id without any extension that will change based upon query) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 php 文档中的
$_SERVER['REQUEST_URI']
和header("Location : ")
。Look at php docs for
$_SERVER['REQUEST_URI']
andheader("Location : ")
.我真的不确定你要什么,
但如果你想获取你所在页面的 URL:
或者如果你谈到从查询字符串中获取某些内容,你会使用:
Page 是页面的查询字符串。 php?page=this_page
I'm really not sure what your asking for,
but if you want to get the the URL of the page you are on:
Or if your speaking about getting something from the query string you would use:
Page being the query string of page.php?page=this_page
听起来您正在寻找类似 mod_rewrite 的东西。
这是一个更容易阅读的解释: http://corz.org/serv/tricks/htaccess2.php
EDIT
我认为你需要这样的东西:
example.php:
.htaccess: *参见下面的注释
注意: 上面的 .htaccess 示例未经测试,并且有一个很好的它有可能无法正常工作,但希望这会有所帮助,并且您可以弄清楚如何调整它以执行您想要的操作。
Sounds like you are looking for something like mod_rewrite.
Here is an easier to read explanation: http://corz.org/serv/tricks/htaccess2.php
EDIT
I think you will need something like this:
example.php:
.htaccess: *see note below
NOTE: The above .htaccess example is NOT tested, and there is a good chance that it doesn't work correctly as it is, but hopefully this helps and you can figure out how to adjust it to do what you want.