• <i id='zM8L6'><tr id='zM8L6'><dt id='zM8L6'><q id='zM8L6'><span id='zM8L6'><b id='zM8L6'><form id='zM8L6'><ins id='zM8L6'></ins><ul id='zM8L6'></ul><sub id='zM8L6'></sub></form><legend id='zM8L6'></legend><bdo id='zM8L6'><pre id='zM8L6'><center id='zM8L6'></center></pre></bdo></b><th id='zM8L6'></th></span></q></dt></tr></i><div id='zM8L6'><tfoot id='zM8L6'></tfoot><dl id='zM8L6'><fieldset id='zM8L6'></fieldset></dl></div>
    1. <tfoot id='zM8L6'></tfoot>
      <legend id='zM8L6'><style id='zM8L6'><dir id='zM8L6'><q id='zM8L6'></q></dir></style></legend>
      • <bdo id='zM8L6'></bdo><ul id='zM8L6'></ul>

        <small id='zM8L6'></small><noframes id='zM8L6'>

      1. PHP 中每个用户的自定义 URL

        时间:2023-09-23
      2. <i id='FujcQ'><tr id='FujcQ'><dt id='FujcQ'><q id='FujcQ'><span id='FujcQ'><b id='FujcQ'><form id='FujcQ'><ins id='FujcQ'></ins><ul id='FujcQ'></ul><sub id='FujcQ'></sub></form><legend id='FujcQ'></legend><bdo id='FujcQ'><pre id='FujcQ'><center id='FujcQ'></center></pre></bdo></b><th id='FujcQ'></th></span></q></dt></tr></i><div id='FujcQ'><tfoot id='FujcQ'></tfoot><dl id='FujcQ'><fieldset id='FujcQ'></fieldset></dl></div>
          <tbody id='FujcQ'></tbody>

          <bdo id='FujcQ'></bdo><ul id='FujcQ'></ul>
        • <tfoot id='FujcQ'></tfoot>
          • <small id='FujcQ'></small><noframes id='FujcQ'>

                <legend id='FujcQ'><style id='FujcQ'><dir id='FujcQ'><q id='FujcQ'></q></dir></style></legend>

                  本文介绍了PHP 中每个用户的自定义 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否有可能有一个网站,每个用户都有自己的 URL,例如:www.thewebsite.com/myusername

                  Is it possible to have a website where each user gets their own URL like: www.thewebsite.com/myusername

                  我希望每个用户站点都相同,名称重要的唯一原因是如果访问该站点的人注册,他们会获得自己的自定义网址,但他们注册的人会被跟踪为他们的父母".

                  I want each user site to be the same, the only reason the name matters is if a person visiting the site signs up, they get their own custom url, but the person they signed up under is kept track of as their "Parent".

                  因此,如果我访问 www.thewebsite.com/phil 并以 David 的身份注册,那么我的站点将变为 www.thewebsite.com/david,但 Phil 会在我的用户记录中进行跟踪.(即有没有办法让我知道他们访问了哪个网址下的网站)

                  So if I go to www.thewebsite.com/phil and sign up as David, then my site becomes www.thewebsite.com/david but Phil is kept track of in my user record. (i.e. is there a way for me to know which url they visited the site under)

                  所以,这真的是两个问题:

                  So, really that's 2 questions:

                  1) 如何为每个用户制作自定义网址2) 我怎么知道新用户访问了哪个网址

                  1) How do I make custom urls per user 2) How do I know which url a new user visited from

                  我对 PHP 非常陌生,所以请记住这一点.

                  I'm pretty brand new to PHP so keep that in mind.

                  推荐答案

                  您可以使用 apache mod_rewrite.

                  You can implement this using the apache mod_rewrite.

                  为以下内容制定重写规则:

                  Make a rewrite rule for something like:

                  ^/users/($1)    /users.php?userid=$1
                  

                  在user.php文件中读取userid参数,返回给定用户对应的页面.

                  In user.php file read the userid parameter, and return the page corresponding to given user.

                  至于从哪个用户注册/登录到您的站点,您可以保留会话值,例如引用用户 ID,并在新用户注册时写入您的数据库,将他推荐到您的站点.

                  As for racking from which user someone registered/logged-in to your site, you can keep a session value, such as the referencing userid, and when the new user registers, write to your db who referred him to your site.

                  这篇关于PHP 中每个用户的自定义 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从 iis7 中的 wordpress URL 中删除 index.php 下一篇:.htaccess 替换(重写)PHP URL 中的 $_GET 变量

                  相关文章

                  <legend id='YPR5x'><style id='YPR5x'><dir id='YPR5x'><q id='YPR5x'></q></dir></style></legend><tfoot id='YPR5x'></tfoot>
                  • <bdo id='YPR5x'></bdo><ul id='YPR5x'></ul>

                  1. <small id='YPR5x'></small><noframes id='YPR5x'>

                    <i id='YPR5x'><tr id='YPR5x'><dt id='YPR5x'><q id='YPR5x'><span id='YPR5x'><b id='YPR5x'><form id='YPR5x'><ins id='YPR5x'></ins><ul id='YPR5x'></ul><sub id='YPR5x'></sub></form><legend id='YPR5x'></legend><bdo id='YPR5x'><pre id='YPR5x'><center id='YPR5x'></center></pre></bdo></b><th id='YPR5x'></th></span></q></dt></tr></i><div id='YPR5x'><tfoot id='YPR5x'></tfoot><dl id='YPR5x'><fieldset id='YPR5x'></fieldset></dl></div>