用户名网址,如 twitter 和 facebook [英] username urls like twitter and facebook

查看:21
本文介绍了用户名网址,如 twitter 和 facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

twitter 和 facebook 等如何制作独特的网址,例如.twitter.com/billgates

how does twitter and facebook etc. make unique url eg. twitter.com/billgates

如果我想做同样的事情(给我的用户提供唯一的带有用户名的 URL),它是一个应用程序还是你为每个用户创建一个带有索引页的目录?

if i would like to do the same (give my users unique urls with username), is it a application or do you crate a directory for each user with a index page??

顺便说一下,我使用的是coldfusion.

by the way im using coldfusion.

谢谢

推荐答案

更一般地说,这些在线服务(Facebook、Twitter、任何存储用户名的站点)使用数据库并进行测试,以查看用户名在当时是否唯一的创作.通常通过在允许创建新帐户之前查询名称(当用户在注册表单中输入名称时,许多使用 ajax 请求来执行此操作).

More generally these online services (Facebook, Twitter, any site that stores a username) use a database and tests for so see if the username is unique at the time of creation. Usually by querying the name before allowing the new account to be created (many do this with ajax requests as the user enters the name in the signup form).

创建帐户后,服务器可以设置为在收到 URL 请求时处理路径名(使用 mod_rewrite 之类的东西),并将信息传递给脚本,然后脚本访问该用户在数据库中的信息并呈现页面.

Once the account is created then the server can be set up to handle the path name (using something like mod_rewrite) when a URL request is received, and pass along the information to a script that then accesses that user's information in the database and renders the page.

这个 blogpost &视频似乎很有帮助,但由于我不确定您的设置是什么,它至少应该为您指明正确的方向... Coldfusion 也让我感到害怕.

This blogpost & video seem to be pretty helpful but since I'm not sure what your setup is it should at least point you in the right direction... Also Coldfusion scares me.

这篇关于用户名网址,如 twitter 和 facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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