From the course: PHP Techniques: Working with Files and Directories
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Create a log file - PHP Tutorial
From the course: PHP Techniques: Working with Files and Directories
Challenge: Create a log file
(upbeat music) - [Instructor] It's time for a challenge assignment. In this challenge, I want you to take everything we've learned about working with files and directories and PHP throughout this chapter and work to create a log file. The idea is that in an application, you very often want to log some information to a log file. And so we want to write a PHP function that will make that easy. The function might be called something like log underscore action, and you can pass in information to it like the action or a message or both. Then inside that function, everything we need to log to the log file would be included. So all we have to do is call log action and we can log information to our log file. The assignment is fairly open-ended in how you actually accomplish that but I will give you a couple of suggestions and reminders. First, choose a file path for the log file. Where is the log file going to be located?…
Contents
-
-
-
(Locked)
Filesystem basics6m 6s
-
Relative paths and magic constants4m 53s
-
(Locked)
Accessing files5m 4s
-
(Locked)
Reading from files4m 52s
-
(Locked)
Reading line by line5m 9s
-
(Locked)
File permissions5m 34s
-
(Locked)
Writing to files5m 5s
-
(Locked)
Writing line returns2m 28s
-
(Locked)
Deleting files2m 38s
-
(Locked)
Moving the file pointer7m 36s
-
(Locked)
Examining file details6m 52s
-
(Locked)
Challenge: Create a log file2m 2s
-
(Locked)
Solution: Create a log file3m 17s
-
(Locked)
-
-
-