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