如何在php中创建我的网站的日志文件? [英] How to create log file of my web site in php?
本文介绍了如何在php中创建我的网站的日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在php中创建我的网站的日志文件?这有助于我维护每个用户访问的网页的数据&;他们在我的网站上执行的所有操作.那么有什么伙伴可以帮助我吗?
I want to know how to create log file of my web site in php? Which help me to maintain data about Pages visited by each user & all actions they done in my website. So any buddy can help me?
感谢,
推荐答案
$file = 'people.log';
// The new person to add to the file
$person = "John Smith\n";
// Write the contents to the file,
// using the FILE_APPEND flag to append the content to the end of the file
// and the LOCK_EX flag to prevent anyone else writing to the file at the same time
file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
Please see the manual page for file_put_contents()
.
这篇关于如何在php中创建我的网站的日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文