Skip to content

Instantly share code, notes, and snippets.

@freshsnippets
Created May 3, 2012 03:13
Show Gist options
  • Save freshsnippets/2582760 to your computer and use it in GitHub Desktop.
Save freshsnippets/2582760 to your computer and use it in GitHub Desktop.
PHP: Write to a File
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
$data = 'This is the data';
fwrite($handle, $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment