December 2013
Intermediate to advanced
306 pages
6h 26m
English
If you're reading from a disk (as we have seen previously), you'll probably want to write to a disk. Now, we'll look at creating several types of files and writing them to a location on the disk.
We're going to amend the file:
/path/to/codeigniter/application/controllers/write_file.phpAmend /path/to/codeigniter/application/controllers/file/file.php to reflect the following:
public function write() { // Set data $data_to_write = 'This is text which will be written to the file'; // Define path for file $path = "/path/to/write/to/with/filename.extension"; if (!write_file($path, $data_to_write)) { // Error echo 'Error writing to file: ' . $path; } else { // Everything worked echo 'Data written to '. $path; ...Read now
Unlock full access