What is the different between cookies and session in php?
Answer Posted / vivek srivastava
Sessions: are basically tokens which are generated when a
user proceeds with a login mechanism. Each time when a user
logged into a website a new and unique token is generated
and it will destroyed whenever he/she logged out from that
site or power goes off. However, session information is
temporary and will be deleted after the user has left the
website.
Cookies:are temporary files which are store in users hard
disk. A cookie is often used to identify a user. Suppose a
user enters into a website and without logging off he/she
closed the page, next time when he/she open the page he/she
found himself/ herself logged in. This is because of
cookies, they store the user information. We can set the
cookies by <b>setCookie()</b> function. The syntax if
setCookie function is <b>setCookie(name, value, expire,
path, domain);</b>.
| Is This Answer Correct ? | 30 Yes | 2 No |
Post New Answer View All Answers
Explain me differences between get and post methods?
What is the difference between explode () and split () functions in php?
What are arguments in php?
What is the main difference between require() and require_once()?
How does php work with apache?
Is php object oriented?
Explain what does $_files means?
Do you know how to get the ip address of the client?
What is the default session time in php?
What does the initials of php stand for?
Are parent constructors called implicitly inside a class constructor?
What is the goto statement useful for?
I am writing an application in php that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with php?
What does addslashes do in php?
How can php and html interact?