0
让我们3个关键字:阳光,镜,日食如何插入搜索查询字符串中的锚
当使用形式进行搜索:
<form method="get" action="search.php">
<input name="q" type="search">
</form>
网址看上去很漂亮,像这样:
http://localhost/gallery/search.php?q=sunlight+mirror+eclipse
到目前为止 太好了。
当试图插入搜索字符串的锚,这样
// get the query string
if (isset($_GET['q'])) {
$current_q = $_GET['q'];
}
<a href="<?php echo 'http://localhost/gallery/search.php?q=' . $current_q; ?>">this is my query</a>
我得到weirds人物丑陋的东西在关键字之间,就像这样:
http://localhost/gallery/search.php?q=sunlight%20mirror%20eclipse
为什么?如何使它更好,就像使用表单一样?
感谢
当有人downvote他可以解释为什么至少 – codinginsane 2014-12-05 22:01:37
尝试它,但我得到关键字之间的怪异字符。顺便说一句,我没有投票。 – Marco 2014-12-05 22:03:53
@Marco现在尝试 – codinginsane 2014-12-05 22:08:20