使用 PHP $_GET 修正超链接 URL 的语法

2022-01-04 00:00:00 url href get php html

我想知道如何将来自我网站的信息放入我网站第一页的 URL 中,然后在下一页上,使用 $_GET 从 URL 获取变量.

I am wondering how I would put information from my website in the URL on the first page of my site, and then on the next page, use $_GET to get the variables from the URL.

我只是想把它放在一个像 <a href="mywebsite.com/page?name=$name"></a> 这样的链接里,如果我就是这样做的,如果可以,我将如何从 URL 中获取它?

I was just wanting to put it in a link like <a href="mywebsite.com/page?name=$name"></a> So would it work if I did it like that, and if it would, how would I get it from the URL?

推荐答案

do

<a href="http://mywebsite.com/page?name=<?php echo $name; ?>"></a>

在您的页面中,您可以将名称设为:

And in your page, you could get the name as:

$name = $_GET['name'];

相关文章