我怎么能得到url,如果它是这样的<关键词>


how can i get the url if it is like this <keyword>?

ebsearch/results/?solrsort=<keyword>

当我使用$_GET['solrsort']时,它不打印关键字。

我尝试了strip_tags,但它没有工作。

还有其他解决方案吗?

Thanks in advance.

Try

echo str_replace(array('<','>'),array('&lt;','&gt;'),$_GET['solrsort']);

或(更好的)

echo htmlspecialchars($_GET['solrsort']);

<keyword>将不会在呈现的HTML输出中显示,因为它看起来像一个标签,并且strip_tags()将出于同样的原因完全删除它。

$value=htmlentities($_GET['solrsort']);