在我的标签云中,我的网址看起来像这样
../search.php?query=cat&select=all
../search.php?query=the cat&select=all
我想要做的是,如果关键字是多个单词,如下所示:
../search.php?query=the cat&select=all
在这样的字词之间添加+
../search.php?query=the+cat&select=all
我的默认搜索功能在表单执行的搜索中使用+
,但我也希望我的标签云具有相同的功能。我只是为了看起来这样做。它的工作原理非常好,但我想我还是会问。有人可以帮忙吗?这就是我目前用于标签云中的链接
echo " <a href='../search.php?query=$word&select=all' target='rel' title='".($word)."'>".($word)."</a>";
感谢。
答案 0 :(得分:3)
我认为您正在寻找的是urlencode()功能。
答案 1 :(得分:1)
urlencode
&amp; urldecode
只是您需要的功能。
echo " <a href='../search.php?query=".urlencode($word)."&select=all' target='rel' title='".($word)."'>".($word)."</a>";
在另一页上,您可以urldecode
echo urldecode($_GET['query']);