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 +}