PHP 动态文件夹

发布于 2024-09-07 04:35:45 字数 318 浏览 1 评论 0原文

使用 PHP,如何制作动态文件夹系统,例如 http://website.com/user/UsernameHere/ 显示类似 http://website.com/user.php?name=UsernameHere

这是否需要服务器配置,或者可以使用 PHP 实现吗?

Using PHP, how can you make a dynamic folder system, like http://website.com/user/UsernameHere/ show something like http://website.com/user.php?name=UsernameHere

Does this require server configuration, or is it possible with PHP?

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

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

发布评论

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

评论(2

十六岁半 2024-09-14 04:35:45

通常,这将依赖于 Web 服务器的一定量的 URL 重写支持,例如 apache 下的某些 mod_rewrite 规则。

无论它是一堆复杂的重写规则,还是只是一个将所有内容重写到 /index.php 的简单规则(让我们用 index.php 解析和解释 URI),都没关系。

但您需要一定量的 Web 服务器配置才能使其正常运行。

Typically this will rely on some amount of URL-rewriting support from the web server, for instance, some mod_rewrite rule under apache.

Whether or not it's a bunch of complicated rewrite rules, or just a simple one that rewrites everything to /index.php (and let's index.php parse and interpret the URI), doesn't matter.

But you'll need some amount of web server configuration to get it going.

如果没有你 2024-09-14 04:35:45

There's a few techniques for doing this. It's nearly possible to clean up your URLs using just PHP, but ultimately if you want to get rid of the ".php" extension you'll need to do something with your server. If it's Apache you can clean up using the .htaccess file.

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