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

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

问题描述

我目前正在开发一个主要使用PHP编写的网站,该网站允许用户注册并输入一些信息。我想在我的网站上给他们一个唯一的网址(网页),其中包含他们的信息,因此可以被他们收藏或快速访问。我是否需要在虚拟目录中为每个用户创建一个文件夹?

I am currently developing a site written in primarily PHP that allows users to signup and enter in some information. I would like to give them a unique url (web page) on my site that contains their information so it can be favorited, or quickly accessed by them. Do I need to create a folder in the virtual directory for each user ?

推荐答案

您好,

您可以使用网址重写。 (我今天第二次提到这个!)。


无论如何,基本上你使用查询字符串让你的页面工作...

例如domain.com/index.php?user=harshmaul

然后你把它改写成这个....

domain.com/harshmaul/


这就是你想要的吗?


如果那就是你想要的,请查看htaccess中的mod重写。
Hi,
You could use url rewrites. (second time i mentioned this today!).

Anyway basically you make your page work using querystrings...
e.g. domain.com/index.php?user=harshmaul
and then you rewrite it to this....
domain.com/harshmaul/

Is that what you going for?

If thats what you want,check out mod rewrites in the htaccess.



我目前正在开发一个主要用PHP编写的网站,允许用户注册并输入一些信息。我想在我的网站上给他们一个唯一的网址(网页),其中包含他们的信息,因此可以被他们收藏或快速访问。我是否需要在虚拟目录中为每个用户创建一个文件夹?
I am currently developing a site written in primarily PHP that allows users to signup and enter in some information. I would like to give them a unique url (web page) on my site that contains their information so it can be favorited, or quickly accessed by them. Do I need to create a folder in the virtual directory for each user ?



我相信你可以创建一个脚本来创建一个文件夹,其中唯一的用户名是文件夹的名称,用户特定的内容(例如图片)放在其中。

另一方面,通过构建SQL以将用户特定信息绘制到用户的页面中,可以在创建即时页面时有一些优势。一个数据库,如下所示:

I believe you can create a script to create a folder with the unique username as the name of the folder, and user-specific content (e.g. pictures) place therein.
On the other hand, there may be a couple of advantages in creating the page ''on the fly'', by constructing an SQL to draw user-specific information into the user''s page from a database, like so:

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号




Ifedi写了一些好的逻辑。如果您确实使用动态页面使页面正常工作通过我上面提到的查询字符串。我们可以将这些重新写入看似该用户的子文件夹。
Hi,
Ifedi has written some good logic. if you do get the page working using a "on the fly page" via the querystring as i mentioned above. we can re-write these into what appears to be a subfolder for that user.


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

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