file_put_contents() fix for php 4


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



Copy this code and paste it in your HTML
  1. <?php
  2. if(!function_exists('file_put_contents')) {
  3. function file_put_contents($filename, $data, $file_append = false) {
  4. $fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
  5. if(!$fp) {
  6. trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
  7. return;
  8. }
  9. fputs($fp, $data);
  10. fclose($fp);
  11. }
  12. }
  13. ?>

URL: http://drupal.org/node/90713

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.