问一下有没有代码大佬 [复制链接]

帖子链接已复制到剪贴板
V zc (UID: 1996) 4月前

1090 7

求助一下大佬,我之前搭建了一个在线邮局,一直没发现有个小问题

https://www.email.sn.cn/status.php

这是邮局的状态页面,里面有一个已发送和待发送邮件的数据,应该是获取数据库里面的“sent"和"waiting"表,但是问题是,似乎数据对不上,请问有没有大佬帮忙看看。代码如下


<?php
require_once "header.php";
class Row {
  public function __construct($conn) {
    $this->sql = $conn;
  }

  public function getRow($tablename) {
    $this->commed = mysqli_fetch_assoc(mysqli_query($this->sql,"select * from `TABLES` where `TABLE_NAME`='$tablename'"));
    $this->num = $this->commed['TABLE_ROWS'];
    //所有数据
    echo $this->num;
  }
}

class status {
  var $conn;
  var $seconds;
  
  function __construct($conn) {
    $this->sql = $conn;
  }
  
  function getRuntime() {
    $this->Starttime = strtotime("2022-10-26");  //开始时间
    $this->Nowtime = strtotime(date("Y-m-d"));
    $this->diff = $this->Nowtime - $this->Starttime;
    $this->Runtime = abs(round($this->diff / 86400));
    echo $this->Runtime;
  }
}
// 服务是否在运行 | 已发送  | 未发送 | 发送时间段 | 累计运行时间段

$status = new status($conn);
$row = new Row($conns);

?><style>
    .allText{
        text-decoration: underline;
    }
</style>
<div class="mdui-container">
    <div class="mdui-typo">
    <div class="mdui-table-fluid">
      <table class="mdui-table">
        <tbody>
          <tr>
            <td>运行天数</td>
            <td><?php $status->getRuntime();?>天</td>
          </tr>
          <tr>
            <td>已发送</td>
            <td><?php $row->getRow("sent");?>封</td>
          </tr>
          <tr>
            <td>待发送信件</td>
            <td><?php $row->getRow("waiting");?>封</td>
          </tr>
        </tbody>
      </table>
    </div></div></div>
    <?php require_once "footer.php"; ?>
zc.wiki
已有评论 (7)
提示:您必须 登录 才能查看此内容。
创建新帖
广告推广点击空位自助购买