我想知道如何在php中创建我的网站的日志文件?这有助于我维护有关每个用户访问的页面的数据&他们在我的网站上做的所有动作。有朋友能帮我吗?
谢谢,
$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);
请参阅file_put_contents()
的手册页