Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 修改查询字符串的.htaccess_Php_.htaccess - Fatal编程技术网

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;
 ?>