8.17 SummaryThis is NOT the latest copy of this book; click here for the latest version.
-
Files are a great place to store information across requests, and PHP gives you lots of ways to manipulate them. Older PHP scripts are unlikely to contain easier functions such as file_get_contents() and file_put_contents(), but these are very efficient functions and you should make use of them yourself.
-
Despite their flexibility, there is only so far files can take you - no matter how short the space between your fopen() s and fclose() s, it is still possible that two scripts may try to read from the same file at the same time.
-
File permissions can often be confusing, particularly on a server that does not belong to you. In this circumstance, make use of functions like is_readable() to make sure you have the right permissions before attempting any operations.
-
Thanks to the flexibility of PHP, you can treat HTTP and FTP connections as if they were local files, reading and writing freely.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|