How to print a debug log?

前端 未结 15 1832
北海茫月
北海茫月 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条回答
  •  萌比男神i
    2020-12-12 10:28

    You need to change your frame of mind. You are writing PHP, not whatever else it is that you are used to write. Debugging in PHP is not done in a console environment.

    In PHP, you have 3 categories of debugging solutions:

    1. Output to a webpage (see dBug library for a nicer view of things).
    2. Write to a log file
    3. In session debugging with xDebug

    Learn to use those instead of trying to make PHP behave like whatever other language you are used to.

提交回复
热议问题