$value) { $set[] = $key . ' = :' . $key; } $sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $set); if ($where) { $sql .= ' WHERE ' . $where; } return $sql; } // 构建 SELECT 语句 public static function select($table, $fields = '*', $where = '', $order = '', $limit = '') { $sql = 'SELECT ' . $fields . ' FROM ' . $table; if ($where) { $sql .= ' WHERE ' . $where; } if ($order) { $sql .= ' ORDER BY ' . $order; } if ($limit) { $sql .= ' LIMIT ' . $limit; } return $sql; } // 构建 DELETE 语句 public static function delete($table, $where = '') { $sql = 'DELETE FROM ' . $table; if ($where) { $sql .= ' WHERE ' . $where; } return $sql; } }