dpstir0081 2011-10-19 17:11
浏览 22
已采纳

从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.

  • 写回答

2条回答 默认 最新

  • donglian1384 2011-10-19 17:13
    关注

    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>");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?