Simple Log writing function implemented by php. Simple Log writing function implemented by php this article describes the simple log writing function implemented by php. Share it with you for your reference. The implementation method is as follows: 123456789 simple log writing function implemented by func php
This example describes the simple log writing function implemented by php. Share it with you for your reference. The specific implementation method is as follows:
| 1 2 3 4 5 6 7 8 9 |
Function log ($ logthis ){ File_put_contents ('logfile. log', date ("Y-m-d H: I: s "). "". $ logthis. "\ r \ n", FILE_APPEND | LOCK_EX ); } // Use \ r \ n for new line on windows, just \ n on linux // PHP_EOL cross platform solution for new line /// So better to use this Function log ($ logthis ){ File_put_contents ('logfile. log', date ("Y-m-d H: I: s"). "". $ logthis. PHP_EOL, FILE_APPEND | LOCK_EX ); } |
Examples in this article describes the simple log writing functions implemented by php. Share it with you for your reference. The specific implementation method is as follows: 1 2 3 4 5 6 7 8 9 func...