每 24 小时添加一个新的 table 行

Add a new table row every 24 hours

我的问题很简单,因为我对动态编码语言还很陌生。

基本上,我想每 24 小时向我的 table 添加一个新的 table 行。新的 table 行应该每天添加到 00:00 并且 table 数据将成为一个预设变量,这不是问题。

这是代码:

<?php

$test="London"

?>



<table width"100%">

  <tr>
    <th width="30%">From</th>
    <th width="30%">Player</th>  
    <th width="40%">Price</th>
  </tr>

  <tr>
    <td><?php echo $test ?></td>
    <td></br></td>    
    <td></br></td>
  </tr>

 

</table>

如果这是在基于 Unix 的服务器上,您需要使用一个名为 crontab 的工具。在连接到您的服务器的终端中输入 crontab -e 并输入:

0 0 * * * php /path/to/script.php

然后保存文件。在此示例中,script.php 是添加新行的文件。

crontab 文件结构如下:

minute hour date month day command

因此在示例中,这发生在每个日期、月份和日期的第 0 分钟、第 0 小时。