How to print a debug log?

前端 未结 15 1870
北海茫月
北海茫月 2020-12-12 10:07

I\'d like to debug some PHP code, but I guess printing a log to screen or file is fine for me.

How should I print a log in PHP code?

The u

15条回答
  •  误落风尘
    2020-12-12 10:25

    If you are on Linux:

    file_put_contents('your_log_file', 'your_content');
    

    or

    error_log ('your_content', 3, 'your_log_file');
    

    and then in console

    tail -f your_log_file
    

    This will show continuously the last line put in the file.

提交回复
热议问题