求助一下大佬,我之前搭建了一个在线邮局,一直没发现有个小问题
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"; ?>