douchu4048 2014-11-21 03:27
浏览 10

日期不会显示

I'm trying to display a simple php date function in a HTML table, but when I run the page it just displays the actual code in the table.

    <?php
echo"
    <table border='1'>
        <tr>
            <td>
                echo date('l jS \of F Y h:i:s A');
            </td>
            <td>Rectangle 2</td>
        </tr>
        <tr>
            <td>Rectangle 3</td>
            <td>Rectangle 4</td>
        </tr>
        <tr>
            <td>Rectangle 5</td>
            <td>Rectangle 6</td>
        </tr>
        <tr>
            <td>Rectangle 7</td>
            <td>Rectangle 8</td>
        </tr>
        <tr>
            <td>Rectangle 9</td>
            <td>Rectangle 10</td>
        </tr>
    </table>";
?>
  • 写回答

3条回答 默认 最新

  • dsuikgi9199 2014-11-21 03:33
    关注

    Try this code. You didn't need an echo first also date() is not an HTML function its an PHP function.

    <?php
    echo"<table border='1'>
    <tr>
    <td>".
    date("l jS \of F Y h:i:s A"). "
    </td>
    <td>Rectangle 2</td>
    </tr>
    <tr>
    <td>Rectangle 3</td>
    <td>Rectangle 4</td>
    </tr>
    <tr>
    <td>Rectangle 5</td>
    <td>Rectangle 6</td>
    </tr>
    <tr>
    <td>Rectangle 7</td>
    <td>Rectangle 8</td>
    </tr>
    <tr>
    <td>Rectangle 9</td>
    <td>Rectangle 10</td>
    </tr>
    </table>";
    
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了