From c95d20fb4c63a4e58faa60b695b5aa31cd6e5f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=96=87=E5=81=A5?= Date: Sat, 27 Aug 2022 18:43:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E5=80=BC=E4=B8=BA=E7=A9=BA=E4=B8=8D=E5=8F=82=E4=B8=8E=E7=AD=BE?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChat/Contracts/BasicWePay.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WeChat/Contracts/BasicWePay.php b/WeChat/Contracts/BasicWePay.php index 8fb69bf..52e4338 100644 --- a/WeChat/Contracts/BasicWePay.php +++ b/WeChat/Contracts/BasicWePay.php @@ -122,7 +122,10 @@ class BasicWePay { ksort($data); if (isset($data['sign'])) unset($data['sign']); - foreach ($data as $k => $v) $buff .= "{$k}={$v}&"; + foreach ($data as $k => $v) { + if ('' === $v || null === $v) continue; + $buff .= "{$k}={$v}&"; + } $buff .= ("key=" . $this->config->get('mch_key')); if (strtoupper($signType) === 'MD5') { return strtoupper(md5($buff)); @@ -201,4 +204,4 @@ class BasicWePay } return $result; } -} \ No newline at end of file +}