From c632977ca1218e8799c2bce23e0cdf090d99ecca Mon Sep 17 00:00:00 2001 From: whale Date: Sun, 26 Apr 2020 16:04:02 +0800 Subject: [PATCH] update value comment --- src/ZM/DB/SelectBody.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ZM/DB/SelectBody.php b/src/ZM/DB/SelectBody.php index d4daab19..b3159686 100644 --- a/src/ZM/DB/SelectBody.php +++ b/src/ZM/DB/SelectBody.php @@ -44,10 +44,12 @@ class SelectBody return $this->fetchAll()[0] ?? null; } - public function value() { + public function value($key = null) { $r = $this->fetchFirst(); if ($r === null) return null; - return current($r); + if ($key === null) + return current($r); + else return $r[$key] ?? null; } public function execute() { @@ -85,4 +87,4 @@ class SelectBody } return [$msg, $array ?? []]; } -} \ No newline at end of file +}