core/Mysql.php
public function getMax(string $tbname, string $field, $where = null, $args = null)
    {
        $sql = "select max(`{$field}`) from {$tbname}";
        if ($where !== null) {
            $where = trim($where);
            if ($args != null) {
                $args = is_array($args) ? $args : [$args];
            }
            if (is_int($where) || is_numeric($where)) {
                $args = [intval($where)];
                $where = 'id=?';
            }
            $sql .= ' where ' . $where;
        }
        $row = $this->getRow($sql, $args, PDO::FETCH_NUM);
        if ($row == null) {
            return null;
        }
        return $row[0];
    }
public function getMax(string $tbname, string $field, $where = null, $args = null)
    {
        $sql = "select max(`{$field}`) from {$tbname}";
        if ($where !== null) {
            $where = trim($where);
            if ($args != null) {
                $args = is_array($args) ? $args : [$args];
            }
            if (is_int($where) || is_numeric($where)) {
                $args = [intval($where)];
                $where = 'id=?';
            }
            $sql .= ' where ' . $where;
        }
        $row = $this->getRow($sql, $args, PDO::FETCH_NUM);
        if ($row == null) {
            return null;
        }
        return $row[0];
    }
获取某个字段的最大值
@param string $tbname
@param string $field
@param null $where
@param null $args
@return null
@throws MysqlException