How to read the query string in PHP and HTML?

前端 未结 3 392
悲哀的现实
悲哀的现实 2020-12-06 07:37

a URL ending with something like portal.php?key2=hello how can I get the value of \"key2\"?

3条回答
  •  生来不讨喜
    2020-12-06 07:55

    $_GET['key2']
    

    will get you the value from a query string.

    $_POST['key2']
    

    will get you the value from a form posted.

    $_REQUEST['key2']
    

    will get you either of the above if it exists.

提交回复
热议问题