如何通过URL路径传递参数

发布于 2024-12-23 16:28:57 字数 176 浏览 1 评论 0原文

有一些网站通过 URL 发送参数,如下所示:

www.site.com/user/12345678

(就像stackoverflow一样)

有人可以就这个论点进行一些讲座吗?我想了解它是如何工作的并将其实现到我的 php 平台中。

There are some sites that send parameters via URL like this:

www.site.com/user/12345678

(just like stackoverflow does)

Can someone give some lectures about the argument? I'd like to learn how this works and implement this into my php platform.

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

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

发布评论

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

评论(3

无畏 2024-12-30 16:28:57

这些“漂亮的网址”是通过使用 mod_rewrite 来完成的。

任何好的框架都会实现此功能(通常称为路由),并且在 MVC 架构中将提供诸如 http://www.mysite.com/controller/view/param1/param2...等

网上有大量关于“mod 重写教程”的教程,例如 这个

Those "pretty urls" are accomplished with the use of mod_rewrite.

Any good framework will have this implemented (usually called routes) and in MVC architecture will provide links such as http://www.mysite.com/controller/view/param1/param2...etc.

There are tons of tutorials on the web for "mod rewrite tutorial" such as this one.

吾家有女初长成 2024-12-30 16:28:57

快速回答:Google 关键字 mod_rewrite.htaccess

结果示例:http: //www.easymodrewrite.com/

Quick answered: Google keywords mod_rewrite and .htaccess

Example result: http://www.easymodrewrite.com/

︶葆Ⅱㄣ 2024-12-30 16:28:57

这称为“URL 重定向”。这样做通常是为了使 URL 对用户和 SEO 友好。您可以找到示例/脚本来重定向您的 URL:

http://www.sitepoint.com/指南 url 重写/

This is called "URL Redirection". This is usually done to make URLs user and SEO friendly. You can find the examples/scripts to redirect your URL:

http://www.sitepoint.com/guide-url-rewriting/

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