如何创建与facebook相同的登录url ?(PHP)
<<p> +例子/strong>www.abc.com
+后登录
用户= a1
www.abc.com/a1/index.php
用户= a2
www.abc.com/a2/index.php
如何在PHP中发明这个?
如果您正在使用PHP,那么您可能正在使用带有mod_rewrite的Apache。类似的。htaccess规则将把路径的用户名部分重写为PHP可访问的变量:
^/([a-Z0-9]*)/index.php /userhome.php?username=$1
这将获取一个类似/foobar/index.php
的URL并将其映射到文件userhome.php
,变量$_GET['username']
设置为foobar
。
事情不像你想的那么简单。http://corz.org/serv/tricks/htaccess2.php
尝试查找名为*mod_rewrite*的东西.htaccess