我想在<;a href>;标签,位于重定向到的页面中


I want to display the text within the <a href> tag, in the page that it redirects to

我引用的带有锚点标记的页面应该显示我在其中所写的内容。例如:

echo "<a href='".$question."'>$question</a>"

应将$question中的文本显示为其链接到的页面中的文本。

如何使用php或html实现这一点?

附言:我是php和stackoverflow的新手!因此,欢迎提出任何建议。

将数据作为GET参数传递到URL:

<a href="example.com?q=<?php echo urlencode($question); ?>"></a>

在PHP中:

if (isset($_GET['q'])) {
    echo htmlspecialchars($_GET['q'], ENT_QUOTES);
}