Home  >  Article  >  Backend Development  >  PHP $_GET

PHP $_GET

巴扎黑
巴扎黑Original
2016-11-12 09:32:292101browse



PHP $_GET can also be used to collect form data after submitting an HTML form (method="get").

$_GET can also collect data sent in the URL.

Suppose we have a page containing hyperlinks with parameters:

<html>
<body>
<a href="test_get.php?subject=PHP&web=W3school.com.cn">测试 $GET</a>
</body>
</html>
当用户点击链接 "Test $GET",参数 "subject" 和 "web" 被发送到 "test_get.php",然后您就能够通过 $_GET 在 "test_get.php" 中访问这些值了。
下面的例子是 "test_get.php" 中的代码:
实例
<html>
<body>
<?php 
echo "Study " . $_GET[&#39;subject&#39;] . " at " . $_GET[&#39;web&#39;];
?>
</body>
</html>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn