PHP rename with date stamp -
we want make script renames file name date stamp, we're new php have now.
<?php rename("test.txt", "tes3.txt"); ?>
we tried things below don't work.
$date = new datetime(); echo $date->format('y-m-d h:i:sp') . "\n";
i hope guys have answer how can this. thanks
all have use textual output (string) produced $date->format(...)
, inject answer in rename call.
$date = new datetime(); rename("test.txt", "test" . $date->format('y-m-d h:i:sp') . ".txt");
but advisable not use spaces in filenames, if want files accessible through server/website/...
Comments
Post a Comment