Chapter 10. Working with Files
Testing, reading, and writing to files are staple activities for any full-featured programming language. PHP is no exception, providing you with functions that make the process straightforward. In this hour, you will learn
How to include files in your documents
How to test files and directories
How to open a file before working with it
How to read data from files
How to write or append to a file
How to lock a file
How to work with directories
Including Files with include()
The include()
statement enables you to incorporate files into your PHP documents. PHP code in these files can be executed as if it were part of the main document. This can be useful for including library code in multiple pages.
Having created a killer function, ...
Get Sams Teach Yourself PHP, MySQL™ and Apache in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.