V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Bitex
V2EX  ›  问与答

为什么大多数网站的用户名都要求“必须以字母开头”?

  •  
  •   Bitex · 2014-12-05 12:19:37 +08:00 · 5463 次点击
    这是一个创建于 3673 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用数字开头会有什么问题?
    12 条回复    2014-12-06 09:49:52 +08:00
    icecoffee
        1
    icecoffee  
       2014-12-05 12:27:34 +08:00   ❤️ 3
    http://ux.stackexchange.com/questions/16101/why-do-so-many-websites-have-the-restriction-of-user-names-starting-with-a-lette

    An advantage of this restriction is URLs.

    If a user's ID is 177896 and their username is H4rold, then you can have 2 URLs to reach this user depending on which information you have at hand:

    http://example.com/user/177896
    http://example.com/user/H4rold

    Then, on that page, they determine how to look up the user by checking whether the first character is a letter or a digit. Alternatively, they could just force you to include at least one non-numeric character, though that increases the complexity of the check from a character comparison to either a regular expression or a looping multiple-character comparison.

    However, not all websites with these restrictions take advantage of this flexibility. My theory is that web developers have seen this restriction so often that they just took it as the norm rather than investigating its purpose... We do that, sometimes.
    iyaozhen
        2
    iyaozhen  
       2014-12-05 12:32:32 +08:00
    @icecoffee 长知识了
    7colcor
        3
    7colcor  
       2014-12-05 12:44:32 +08:00
    看来本站是例外
    leyle
        4
    leyle  
       2014-12-05 12:55:27 +08:00
    @7colcor 23333333333333
    FrankFang128
        5
    FrankFang128  
       2014-12-05 13:01:14 +08:00
    @icecoffee 用 /userid/123123 和 /username/123123 不就好了……
    dong3580
        6
    dong3580  
       2014-12-05 13:12:32 +08:00
    @icecoffee
    感谢普及知识。
    Bitex
        7
    Bitex  
    OP
       2014-12-05 13:18:50 +08:00
    @icecoffee 感谢,但是我个人认为在url里放用户的数字id是一种比较不礼貌的做法……
    hahastudio
        8
    hahastudio  
       2014-12-05 13:38:20 +08:00
    我觉得不是不礼貌,而是应该避免,毕竟用户并不需要(或者说不该)知道他/她的 ID,如果你有 username 的话
    Bitex
        9
    Bitex  
    OP
       2014-12-05 13:44:21 +08:00
    @hahastudio 同感
    ivanlw
        10
    ivanlw  
       2014-12-05 13:56:06 +08:00
    楼主如果有学过编程的话……
    Bitex
        11
    Bitex  
    OP
       2014-12-05 14:41:31 +08:00
    @ivanlw 楼主必然学过编程
    whywhywhy
        12
    whywhywhy  
       2014-12-06 09:49:52 +08:00
    QQ就是最好证明数字账号没有任何问题的例子 没有之一
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5230 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 03:47 · PVG 11:47 · LAX 19:47 · JFK 22:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.