Home > Backend Development > PHP Tutorial > Simple log writing function implemented in php, php log function_PHP tutorial

Simple log writing function implemented in php, php log function_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:58:49
Original
1039 people have browsed it

Simple log writing function implemented in php, php log function

The example in this article describes the simple log writing function implemented in php. Share it with everyone for your reference. The specific implementation method is as follows:

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);
}

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/976693.htmlTechArticleSimple log writing function implemented in php, php log function This article describes the simple log writing function implemented in php . Share it with everyone for your reference. The specific implementation method is as follows: func...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template