Php 友好的url don';不能识别变量
我在我的Php 友好的url don';不能识别变量,php,.htaccess,Php,.htaccess,我在我的.htaccess中使用 重写规则^profiles/([A-Za-z0-9-]+)/$/profile.php?城市=$1[NC] 访问url时正常工作: https://site.com.br/profiles/londres 但在页面中,在插入变量get后,php仅识别htaccess中配置的变量,例如访问url时: https://site.com.br/profiles/londres?s=username print\r($\u-GET) 返回 Array([city]=>l
.htaccess中使用
重写规则^profiles/([A-Za-z0-9-]+)/$/profile.php?城市=$1[NC]
访问url时正常工作:
https://site.com.br/profiles/londres
但在页面中,在插入变量get
后,php仅识别htaccess中配置的变量,例如访问url时:
https://site.com.br/profiles/londres?s=username
print\r($\u-GET)代码>
返回
Array([city]=>londres)
也就是说,它不会返回GET中的变量s
使用规则中的QSA
标志来获取查询字符串
RewriteRule ^profiles/([A-Za-z0-9-]+)/$ /profile.php?city=$1 [NC,QSA]
参考:
在规则中使用QSA
标志来获取查询字符串
RewriteRule ^profiles/([A-Za-z0-9-]+)/$ /profile.php?city=$1 [NC,QSA]
参考: