mchid = $mchid; $this->account = $account; $this->key = $key; } public function pay ($cny, $type, $trade) { $params = [ 'mchid' => $this->mchid, 'account' => $this->account, 'cny' => $cny, 'type' => $type, 'trade' => $trade ]; $params['signs'] = $this->sign(http_build_query($params)); } public function sign ($str) { return md5($str.$this->key); } public function buildHtml($params, $method = 'post', $target = '_self'){ // var_dump($params);exit; $html = "
"; foreach ($params as $key => $value) { $html .= ""; } $html .= "
"; return $html; } }