Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

php: how to add date of file inside the file

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)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks if so!

>Solution :

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

Hope it help 😉

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading