From the course: PHP with MySQL Essential Training: 2 Build a CMS
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Work with sessions
From the course: PHP with MySQL Essential Training: 2 Build a CMS
Work with sessions
- [Instructor] In this movie, we're going to learn about sessions. Sessions solve a similar problem to cookies, but they do it in a different way, and they have different strengths and weaknesses. So let's talk about how we work with sessions in PHP. When we're going to work with sessions, the way the process works is that we're going to store data in a session file. That's going to be a file that's on the web server. We're not sending the data off to the user for them to put it in a cookie. Instead, what we're going to do is send a reference identifier for that session file to the user as a cookie. So user still gets a cookie, but they don't get actual data. What they get is a reference identifier for a file that sits on the web server, and then PHP will handle the retrieval of that session file. It'll take the cookie data, it'll see the reference identifier. It'll go to the file system, find the file, open it up, and get the values that are in the session out of there, ready for us…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.