Home > Backend Development > PHP Tutorial > How to use the error_log() function in PHP, phperror_log_PHP tutorial

How to use the error_log() function in PHP, phperror_log_PHP tutorial

WBOY
Release: 2016-07-13 10:09:23
Original
1216 people have browsed it

How to use the error_log() function in PHP, phperror_log

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)

Copy code The code is as follows:
if(!empty($_POST) ){
while (list($key, $val) = each($_POST))
{
@error_log("$key => $val", 3,'/tmp/test_post_allstarpay.log' );
}
}

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/945715.htmlTechArticleHow to use the error_log() function in PHP, phperror_log 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: Today I met...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template