InterviewSolution
| 1. |
What is a session in PHP? |
|
Answer» In PHP, a session is a means to save data that can be utilized across various pages of a website. Unlike cookies, the information is not saved on the user's machine. The session will generate a file in a TEMPORARY directory on the server to hold registered session variables and their values. During that visit, this information will be available on all pages of the site. When working with an application, you open it, make changes to it, and then close it. The computer is aware of when you start and stop the application. However, because the HTTP address does not RETAIN a state on the internet, the webserver has no idea who you are or what you do. Session variables are used to SOLVE this problem by saving user information that can be used across many pages (e.g. username, favourite colour, etc). Session variables are lasting until the user closes the browser. Session variables, on the other hand, store information about a single user and are accessible from all pages in a single application. |
|