What is different between session and cookie? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is different between session and cookie?

Session data is stored in server and cookie store data in the visitors .What should be used session or cookie?

26th Jan 2018, 1:30 AM
Nyi Nyi Myat
Nyi Nyi Myat - avatar
2 Answers
+ 8
Sessions allow you to store away individual pieces of information just like with cookies, but the data gets stored on the server instead of the client. A session is used to store the information from the web pages. ... With PHP session you can't access it anywhere outside PHP script. https://stackoverflow.com/questions/6253633/cookies-vs-sessions
26th Jan 2018, 10:47 AM
Scooby
Scooby - avatar
0
Also a Session is destroyed when a user closes the browser.
25th Mar 2018, 7:31 PM
Jean-louis du Plessis
Jean-louis du Plessis - avatar