How To Start A Session In PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priya.sharma
    Senior Member
    • Aug 2016
    • 105

    How To Start A Session In PHP?

    A PHP session is easily started by making a call to the session_start() function.This function first checks if a session is already started and if none is started then it starts one. It is recommended to put the call to session_start() at the beginning of the page.
  • Swati walia
    Senior Member
    • Sep 2016
    • 108

    #2
    When you work with an application, you open it, do some changes, and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end. But on the internet there is one problem: the web server does not know who you are or what you do, because the HTTP address doesn't maintain state.

    Comment

    • SwatiSood
      Senior Member
      • Jul 2014
      • 104

      #3
      To begin a new session, simply call the PHP session_start() function. It will create a new session and generate a unique session ID for the user. The PHP code in the example below simply starts a new session.

      Comment

      • lisajohn
        Senior Member

        • May 2007
        • 359

        #4
        A PHP session is used to store data on a server rather than the computer of the user. Session identifiers or SID is a unique number which is used to identify every user in a session based environment. The SID is used to link the user with his information on the server like posts, emails etc.

        Comment

        Working...