我试图重写profile.php?id=1&email=medicalboy@gmail.com到类似regex/profile/9/medicalboy@gmail.com的东西
但是这个规则不起作用:
这就是我所做的
php:<a href="profile/<?php echo $row['userid']; ?>/<?=$row['email']; ?>"><?php echo $row['username']; ?></a><br />
htaccess
RewriteEngine On
RewriteBase /regex/
RewriteRule ^profile/([0-9]+)/(.*)$ profile.php?id=$1&email=$2 [L]
有什么问题吗?我仔细阅读了关于重写的内容,但我不知道问题在哪里
我知道答案
我想如果$_GET将工作与uri像regex/profile/1/66所以$_GET不能获取依赖于uri
的信息所以我使用了explosion()来获取id,就像这样:
$url=$_SERVER['REQUEST_URI'];
$exp=explode("/",$url);
$id=$exp[3];
$query=$db->query("select * from users where userid='$id'");