How to create user profiles with PHP and MySQL

前端 未结 3 592
刺人心
刺人心 2020-12-08 23:39

I need some help on creating a user profile system. I want it to be like Facebook or Myspace where it has only the username after the address, no question marks or anything,

3条回答
  •  无人及你
    2020-12-09 00:30

    You would need to create a mod rewrite that took the first directory and passed it as a $_GET parameter.

    Try this:

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)/$ index.php?user=$1
    

    That should rewrite anything after '/' as index.php?user=directory

提交回复
热议问题