- Cookie is state management object used to maintain state of application.
- cookie data is storing in browser memory location that data we can access from only web page in application.
Cookies are divided into two type
- In-memory Cookie.[RAM]
- Persistent Cookie.[HD]
- If we crate cookie without explicit expiry time comes under in-memory cookie.
- thees store data in RAM memory location in client system.
- the data will destroy when user close the browser.
- cookie with explicit expiry time comes under persistent cookie
- the cookie store the data in the Hard disk memory location and destroy when life time is completed.
- By using persistent cookie we can maintain to browser in client system up to year up to some year according to browser time
- set Cookie:-using this super global variable we can create cookie.
- $_COOKIE:- using this super global variable we can read the data of cookie
- By using this super global variable we can create session and we can access this session.
- Session is state of management object sue to maintain state of application.
- session data we can access from any location within the application.
- session store data in we server.
- session can store large amount of data.
- session start using session_start();
- $_session is use for to set session variable.
- Set the session before your html tags.
- session id is alpha numeric string genereted by web server when user sends 1st request to server.
- At the time of receiving request server checks request contain session,cookie or not if request doesn’t contain session cookie then server create new session_id.
Session Perform This Following task if session start:
- session_id:-using this function we can get session id generated by web server.
- session_unregistered:- To delete session variable.
- session_unset:-To delete all session variable.
- session_destroy:-To destroy session file.