How to use $_GET?

后端 未结 2 1081
温柔的废话
温柔的废话 2020-12-06 23:19

I have the following login script, where i do use sessions.



        
相关标签:
2条回答
  • 2020-12-07 00:04

    $_GET variables are those passed via the URL, i.e. index.php?foo=bar&baz=qux (foo equals bar, baz equals qux).

    These variables are not stored on the server as a part of the session, but rather only exist with that request. If you want to store information on the server as a part of the session, you should use $_SESSION instead, which will exist within the current session, regardless of the request.

    0 讨论(0)
  • 2020-12-07 00:10

    The $_GET superglobal is defined as part of the URL string:

    http://example.org/index.php?foo=bar&baz=1
    

    In index.php:

    echo $_GET['foo']; // bar
    echo $_GET['baz']; // 1
    

    So $_GET is not stored on the server, but is passed with each HTTP request, as is $_POST, but that is passed in the HTTP headers rather than simply appened to the end of the URL.

    0 讨论(0)
提交回复
热议问题