+ 2
What are the uses of session and cookiee in php ?
3 Answers
+ 1
A session is a way to store information (in variables) to be used across multiple pages.
session variables last until the user closes the browser.Session variables hold information about one single user, and are available to all pages in one application.
A cookie is a small file that the server embeds on the user's computer.Ā cookies stores small bit of information in name=value format.
cookie stores frequently accessed information like usernames,form data...
cookie the information is stored on the users computer.(client),while sessions are stored on servers.
+ 1
session is used to store user data throughout the session and will be stored in server side
cookies are used store data in users computer
for example cosider a e commerce website
To have the particular user logged in throughout different pages user details are stored in sessions
To store the cart items cookies can be used and the cart items can be populated when user logins again
user secure information should be saved in sessions as it will be saved on server instead of local system as in cookies
+ 1
what are the methods used to remove session and cookies ?