+ 16
what's the difference between cookies and session in php?..
cookies and sessions are same kind or not..
7 Antworten
+ 11
Cookie is local storing space.. when you turn off the system,the cookie will be destroyed... But, session is server side storing space.. Session cannot be deleted likewise I heard.. I don't know, it is right or not...
+ 11
Thanks for clear the doubt...
+ 5
The difference is that:
A session is created on demand but only lasts for the current browsing session time. that is to say, it gets destroyed automatically when the user closes the browser.
A cookie on the other hand, you can think of it as another variation of "sessions" that can last for a pre determined period of time. an hour, a day, a year, a century....etc. Moreover, any user can access cookie information while the same cannot be done for sessions.
+ 2
Yes, cookie can be manually deleted, as they are small txt files that are stored in the browser. however, as I said, they can be programmed to last longer than the current session if not manually deleted, even when you turn off your computer.
Sessions are stored in the server side that's why you cannot have direct access to them, but they get automatically destroyed as soon as you close your browser or are willingly erased by the server with session_destroy().
+ 1
cookies are deleted manually when we turn off he computer.but sessions are deleted automatically after 24 hr. or 1 day
+ 1
can we destroy server sessions manually by using the browser?
0
What cookie does is, it stores data on your machine/ device. It depends on the time assigned to the cookie code. It can last for every long time. Cookies are not destroyed even after log out but the programmer can enable it to wipe itself immediately after log out or a set period of time.
Sessions, unlike cookies are destroyed the moment you leave the site or log out.