$_GET

创建于 2024-12-03 / 54
字体: [默认] [大] [更大]

超级全局变量是在所有作用域中始终可用的内置变量。


PHP $_GET

PHP $_GET 也可用于收集提交 HTML 表单 (method="get") 之后的表单数据。

$_GET 也可以收集 URL 中的发送的数据。

假设我们有一个HTML页面,其中包含带有参数的超链接:

<html>
<body>

<a href="test_get.php?subject=PHP&web=W3schools.com">Test $GET</a>

</body>
</html>

When a user clicks on the link "Test $GET", the parameters "subject" and "web" are sent to "test_get.php", and you can then access their values in "test_get.php" with $_GET.

The example below shows the code in "test_get.php":

实例

<html>
<body>

<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>

</body>
</html> 亲自试一试 »

提示:PHP 表单 一章中,您将了解有关 $_GET 的更多信息。



0 人点赞过