PHP $_GET ??
$_GET ??
?? ??? $_GET ??? method="get"? ???? ???? ?? ???? ? ?????.
GET ???? ???? ???? ??? ??? ?? ??? ? ? ???(????? ?? ???? ???) ???? ??? ??? ??? ????.
Instance
form.html ?? ??? ??? ????.
<html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <form action="welcome.php" method="get"> 名字: <input type="text" name="fname"> 年齡: <input type="text" name="age"> <input type="submit" value="提交"> </form> </body> </html>
???? "Submit" ??? ???? ??? ???? URL? ??? ????.
http://ipnx.cn/welcome.php?fname=php&age=3
"welcome.php" ??? ?? $_GET ??? ?? ?? ???? ??? ? ????. ?? ?? ??? ???? $_GET ??? ?? ???.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???? <?php echo $_GET["age"] ?>
? ?? ?? ??:
HTTP GET
HTTP GET ??? ? ??? ???? ???? ?? ???, ?? URL(???? ??)?? ??? ???? ?? ??? ?? ?? ? ?? ??? ??? ?????.
HTTP GET ??? ???? ?? ??? ?? ? ???? ??? ??? ??? ?? ????. http://www.5idev.com/html/article.php ?id=10? ???? id=10? ??? ?? GET ???? ?? article.php? ?????. article.php??? $_GET["id"]? ?? ???? ?? ? ????. ?? ??? ???????? ID? 10? ??? ?? ?? ? ????.
article.php? ???:
<?php echo $_GET["type"]; //輸出 2 echo $_GET["id "]; //輸出 10 ?>
?? ? method= "??"?
HTML ???? method="get"? ???? ?? ?? ??? ?? URL? ?????.
??: ??? ????? ?? ??? ??? ?? ?? ? ??? ???? ? ???! ?, URL? ??? ???? ??? ??? ???? ?????. ?? ???? ??? ?????. ??: HTTP GET ??? ? ?? ??? ???? ????. ?? ?? 2000?? ??? ? ????.