从csv创建的PHP表,我需要插入一个日期

Ok I have created a PHP script that prints out data from a .csv file. Everything is good but the header of the Table I want to have it say report for: current date. SO here is what I have?

    <?php
    $NOWDATE = `date +%m%d%y`;
    print('<tr align="center"><td colspan="15"><h2>Revenue Report for: $NOWDATE</h2></td></tr>');
    ?>

This does not work, so I need to find a way to post this to the header.

Use double quotes " for the string so the variable gets interpreted.

You don't need to do an external date call btw - this will do:

$NOWDATE = date("d.m.Y");

code:

print("<tr align=\"center\"><td colspan=\"15\"><h2>Revenue Report for: $NOWDATE</h2></td></tr>");

$now = date('d-m-Y');

Then just add $now to your strings anywhere...

See the php documentation on date() for the different format.

http://php.net/manual/en/function.date.php