Home >Backend Development >PHP Tutorial >How to use the error_log() function in PHP, phperror_log_PHP tutorial
The example in this article describes how to use the error_log() function in PHP. Share it with everyone for your reference. The specific analysis is as follows:
I encountered a problem today that needed to be debugged, but I could only debug it through log printing, so I used the error_log function
What needs to be printed is the post data sent by a server to our server
The code is as follows: (both key and value are printed)
error_log has four parameters, mainly the first three. The first one is the content written in the log log. The second one is the log storage mode 3, which means storing it in the specified location. The third one is the storage location
The server uses centos, and tmp has read and write permissions, so I wrote it into tmp
error_log will automatically generate the corresponding log file, no need to create it manually!
I hope this article will be helpful to everyone’s PHP programming design.