Posted By


mischachen on 10/13/08

Tagged


Statistics


Viewed 576 times
Favorited by 0 user(s)

file_put_contents


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if ( !function_exists('file_put_contents') && !defined('FILE_APPEND') ) {
  2. define('FILE_APPEND', 1);
  3. function file_put_contents($n, $d, $flag = false) {
  4. $mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ? 'a' : 'w';
  5. $f = @fopen($n, $mode);
  6. if ($f === false) {
  7. return 0;
  8. } else {
  9. if (is_array($d)) $d = implode($d);
  10. $bytes_written = fwrite($f, $d);
  11. fclose($f);
  12. return $bytes_written;
  13. }
  14. }
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.