使用 PHP $_GET 修正超链接 URL 的语法 [英] Correct syntax for hyperlink URL with PHP $_GET

查看:18
本文介绍了使用 PHP $_GET 修正超链接 URL 的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将来自我网站的信息放入我网站第一页的 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'];

这篇关于使用 PHP $_GET 修正超链接 URL 的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆