在个人资料用户$ _GET不能正常工作。
我正在使用URL重写
它的
RewriteBase /pline/
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?username=$1
如果用户网址正常(website.com/profile.php?photos)工作
if(isset($_GET['friends'])){
echo 'Friends area!';
}
else{
if(isset($_GET['photos'])){
echo 'Photos area!';
}
else{
echo 'Profile area!';
}
}
我怎么解决这个问题?
谢谢你
根据您的重写规则,只有一个变量称为 username
因此,在您的php中,只会$_GET['username']
获取值
那是默认变量是用户名。所以您应该使用这种链接:website.com/value_for_username
如果您想要更多的变量,请使用website.com/value_for_username&var1=value1&var2=value2
等等。并在必要时更新重写规则以使其与之匹配。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句