我在MVC系统中创建日志时遇到问题。
我的控制器访问模型并渲染视图...直到这一点都没问题。
现在问题来了,我的控制器访问博客的模型,我得到了帖子的id,数据被封装在控制器类中,我该如何用控制器外访问的页面的id创建一个系统日志呢?
谢谢
发布于 2012-02-05 12:30:39
您可以将日志写入文件:
$log_file_path = "/path/log.txt";
$fh = fopen($log_file_path, 'a'); // 'a' for append to the file
$log_text = "Visited Page " . $page_id . "\n"; // This is the line to appear in the log file
fwrite($fh, $log_text);
fclose($fh); // Make sure to close the file
https://stackoverflow.com/questions/9146902
复制相似问题