【发布时间】:2020-11-25 16:15:14
【问题描述】:
我正在为个人资料页面使用 htaccess 友好 URL,例如:
RewriteRule ^([^/]+)/?$ profile.php?id=$1 [L]
如果我打开链接,例如 /some-user,它可以正常工作,并打开个人资料页面。
现在在此个人资料页面中,我有搜索表单,我如何从链接中获取搜索值,因为当我提交时,我得到了这种链接: /some-user?search=somekeywod
提交时,我需要使用搜索值打开该配置文件的 url。
我的搜索表单很简单:
<div class="input-group md-form form-sm form-2 pl-0">
<input class="form-control my-0 py-1 lime-border" type="text" placeholder="Search..." name="search" aria-label="Search">
<div class="input-group-append">
<button type="submit" class="input-group-text lime lighten-2" id="basic-text1"><i class="fa fa-search text-grey"
aria-hidden="true"></i></button>
</div>
</form>```
【问题讨论】:
-
这能回答你的问题吗? Rewrite GET Query String using .htaccess
-
没有。我已将 profile.php?id=some-user 重写为 /some-user。现在在里面我需要在该用户配置文件中使用搜索表单,所以如果我点击搜索,它需要打开该用户配置文件并给我 $_GET["search"] 值。
标签: php