PHP Log to Text File

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

Just simple logging to a text file for so many reasons.

Copy this code and paste it in your HTML
  1. function doLog($text)
  2. {
  3. // open log file
  4. $filename = "form_ipn.log";
  5. $fh = fopen($filename, "a") or die("Could not open log file.");
  6. fwrite($fh, date("d-m-Y, H:i")." - $text\n") or die("Could not write file!");
  7. fclose($fh);
  8. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.