|
PHP Tutorial Home
Basic PHPPHP IntroductionPHP Installation PHP Syntax PHP Variables PHP Form Variables PHP If Statements PHP Switch Statements PHP Arrays PHP While Loops PHP For Loops PHP Operators PHP Functions Advanced PHPPHP IncludePHP Upload File PHP File PHP Mail PHP Database Driven Website PHP Summary |
PHP FileIn the previous lesson we learned how to enable our users to upload files to the server. In this lesson, we'll learn how to work with files on the server. Reading a FileThe following code can be used to read a file.
Here's an explanation of what's happening:
Writing to a FileThe following code can be used to write to a file.
Here's an explanation of what's happening:
Appending Data to a FileThe previous code overwrites any content that might have been in the file. If you only want to add to the end of the existing data, you can simply change the mode from "w" (for "write") to "a" (for "append").
Deleting a FileTo delete a file, you use PHP's unlink() function and provide it with the name/path of the file to delete.
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|