PHP : Write Data To A Text File

3 Mar

<?php

$your_data = “This is the data to be stored in the text file.”;

// Open the file and erase the contents if any
$fp = fopen(“textfile_name.txt”, “w”);

// Write the data to the file
fwrite($fp, $your_data);

// Close the file
fclose($fp);

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: