diff --git a/Database/Command.php b/Database/Command.php index 34925549..8e5e3712 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -152,9 +152,7 @@ class Command extends Component if (!($query = $connect?->query($this->sql))) { return $this->addError($connect->errorInfo()[2] ?? '数据库异常, 请稍后再试.'); } - Coroutine::defer(function () use ($query) { - $query->closeCursor(); - }); + defer(fn() => $query->closeCursor()); if ($type === static::FETCH_COLUMN) { return $query->fetchAll(PDO::FETCH_ASSOC); } else if ($type === static::ROW_COUNT) {