I have a link that downloads a current database Table, I need to it to have the current date attached at the end of the filename every time?
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=CARD_MASTER**DATE HERE**.xls");
header("Pragma: no-cache开发者_运维技巧");
header("Expires: 0");
print "$header\n$data";
header("Content-Disposition: attachment; filename=CARD_MASTER-".date('Y-m-d').".xls");
I just used the Y-m-d format, you can use a different variation by looking into the date()
function
You can insert a date in the header, as you would in any string:
header("Content-Disposition: attachment; filename=CARD_MASTER-" .
date("m-d-y") . ".xls");
精彩评论