Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Initialize a variable to hold the name of the log file.
  2. Use the fopen() function to create or open the log file in append mode.
  3. Use the fwrite() function to write the log message to the log file.
  4. Use the fclose() function to close the log file handle.
  5. (Optional) Use the error_log() function to log errors, warnings, or notices to the same log file.
  6. (Optional) Use the date() function to add timestamps or dates to the log message.
  7. (Optional) Use the fileputcontents() function to write the log message to a file in one line.