Htaccess:清空$ _GET

时间:2012-09-17 07:34:14

标签: php .htaccess get

目前我有一个PHP页面,并且使用htaccess我正在更改页面URL。这是我的Htaccess:

RewriteEngine On
RewriteRule ^customer/edit/(.*)/deletefrom/(.*)/ index.php?page=customer&edit=$1&deletefrom&=$2 [QSA,L]

当我试图从$_GET['deletefrom']获取值时,我得到一个空值。但是$_GET['edit']正在工作并给出一个值,所以这很奇怪。我希望有人可以帮助我。

2 个答案:

答案 0 :(得分:3)

RewriteEngine On
RewriteRule ^customer/edit/(.*)/deletefrom/(.*)/ index.php?page=customer&edit=$1&deletefrom&=$2 [QSA,L]

&在GET参数中用作分隔符,在deletefrom找到&之后,您将获得空值。而不是上面的代码使用以下

RewriteEngine On
RewriteRule ^customer/edit/(.*)/deletefrom/(.*)/ index.php?page=customer&edit=$1&deletefrom=$2& [QSA,L]

答案 1 :(得分:2)

&变量后面有deletefrom