如何使用 PHP 为每个注册用户提供自己的 url? [英] How do I give each registered user their own url using PHP?

查看:23
本文介绍了如何使用 PHP 为每个注册用户提供自己的 url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个购物门户网站,每个客户都会在其中发布他们的产品,一旦付款,我们将为该客户提供单独的用户名和密码.因此,我需要为每个客户分别创建一个 URL 链接,以便显示该特定客户的产品.

I am creating a shopping portal where each customer will post their products and we will be providing a separate username and password for that customer once payment has been made. So I need to create an URL link separately for each customer so that it will show the products of that particular customer.

例如像 Facebook,如果我创建一个单独的帐户,我的页面就会变成 (https://www.facebook.com/dinesh.darkknight),其中显示了我自己的详细信息或帖子.像那样,我需要在我的站点 (www.seloncart.com/customername) 中为每个客户创建一个单独的页面.一旦我给出了那个客户的名字,它就会显示该客户单独发布的产品.

For example like Facebook if I create a separate account, my page becomes (https://www.facebook.com/dinesh.darkknight) where my own details or the posts has been shown. Like that, I need a separate page for each customer in my site (www.seloncart.com/customername). Once I give that customer name it should show the products posted by that customer alone.

推荐答案

  1. 配置您的服务器以通过脚本运行所有内容(例如,在 Apache 中,ScriptAlias//hosts/example.com/htdocs/yourApplication.php)
  2. 查看 $_SERVER['PATH_INFO'] 以确定用户名是什么(如果有的话).
  3. 使用该信息来决定是否要显示产品列表页面"或其他内容
  4. 在您的数据库中搜索适当的数据
  1. Configure your server to run everything through the script (e.g., in Apache, ScriptAlias / /hosts/example.com/htdocs/yourApplication.php)
  2. Look at $_SERVER['PATH_INFO'] to determine what the user name is (if there is one).
  3. Use that information to decide if you are going to show a "list of products page" or something else
  4. Search your database for the appropriate data

您可能会发现很多 MVC 框架对第 2 步和第 3 步有很大帮助.

You'll probably find that a lot of MVC frameworks help rather a lot with steps 2 and 3.

这篇关于如何使用 PHP 为每个注册用户提供自己的 url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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