Home > other >  php: how to add date of file inside the file
php: how to add date of file inside the file

Time:09-16

I want to add the day of file creation date inside the file that's this same script made.

The file i got from my php script is sent by a Curl command run on a linux.

$dir = $folderPath;
file_put_contents($dir ."/info.log", $keep_for_later);

I want to add the date at the end of it. Is it possible? (Date hours)

Thanks if so!

CodePudding user response:

Of cours it is!

$stop_date = date('Y-m-d H:i:s');
$dir = $folderPath;
file_put_contents($dir ."/info.log", $keep_for_later ."date: " .$stop_date);

-- This will add it like that's: 2022-09-15 08:34:37

  • Related