在codeigniter中运行函数后将时间戳保存在文本文件中



无论何时在codeigniter中运行函数,我都希望将时间戳保存在文本文件中。我怎样才能做到呢?

public function updateData(){
Running this function each time it will save the timestamp in a text file.
}

您可以在这里找到更多信息和示例->https://www.w3schools.com/php/php_file_open.asp

public function updateData(){
# Running this function each time it will save the timestamp in a text file.
$path2file = "/docs/";
$fileName = "timestamp.txt";
$data = time()."".PHP_EOL; // PHP_EOL - new line
$fp = fopen($path2file.$filename, 'a');
fwrite($fp, $data);
}

最新更新