Php 修改查询字符串的.htaccess
这是我的工作目录Php 修改查询字符串的.htaccess,php,.htaccess,Php,.htaccess,这是我的工作目录 das |__views |__admin |__doctor |__user |__find-doctor.php |__process.php |__show-result.php |__index.php(landing page) |__index.php(routing) |__.htaccess 我现在拥有的.htaccess是 RewriteEngine On RewriteBase / Rewrite
das
|__views
|__admin
|__doctor
|__user
|__find-doctor.php
|__process.php
|__show-result.php
|__index.php(landing page)
|__index.php(routing)
|__.htaccess
我现在拥有的.htaccess是
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /das/index.php [L]
我需要修改htaccess文件以发送查询字符串,如
localhost/user?doctor-id=2
因此,我可以使用URL中的id在.htaccess中查询数据库
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index/([0-9a-zA-Z]+)-([0-9]+) .php?user=$1&id=$2 [NC,L]
PHP
示例URL:获取参数=医生
get_param_two=who这些get参数默认由重写规则保留。您已经可以在PHP中使用它们了。如果没有,那么如果您有一些非常奇特的设置,那么添加记录在案的
QSA
标志。这是否回答了您的问题@BadHorsie它没有具体回答我的问题,但我了解了系统的工作原理,谢谢
<?php
$get_param_one = $_GET['user'];
$get_param_two = $_GET['id'];
echo $get_param_one;
echo $get_param_two;
?>