[更新]修改支付宝支付 #19

This commit is contained in:
Anyon 2018-11-13 17:37:19 +08:00
parent 7d02bdc83f
commit ef2ab99cb4
3 changed files with 4 additions and 6 deletions

View File

@ -183,7 +183,7 @@ abstract class BasicAliPay
*/ */
protected function applyData($options) protected function applyData($options)
{ {
$this->options['biz_content'] = json_encode($options, JSON_UNESCAPED_UNICODE); $this->options['biz_content'] = json_encode($this->params->merge($options), JSON_UNESCAPED_UNICODE);
$this->options['sign'] = $this->getSign(); $this->options['sign'] = $this->getSign();
} }
@ -216,7 +216,7 @@ abstract class BasicAliPay
protected function buildPayHtml() protected function buildPayHtml()
{ {
$html = "<form id='alipaysubmit' name='alipaysubmit' action='{$this->gateway}' method='post'>"; $html = "<form id='alipaysubmit' name='alipaysubmit' action='{$this->gateway}' method='post'>";
foreach ($this->params->get() as $key => $value) { foreach ($this->options->get() as $key => $value) {
$value = str_replace("'", '&apos;', $value); $value = str_replace("'", '&apos;', $value);
$html .= "<input type='hidden' name='{$key}' value='{$value}'/>"; $html .= "<input type='hidden' name='{$key}' value='{$value}'/>";
} }

View File

@ -31,8 +31,7 @@ try {
'total_amount' => '1', // 支付金额 'total_amount' => '1', // 支付金额
'subject' => '支付订单描述', // 支付订单描述 'subject' => '支付订单描述', // 支付订单描述
]); ]);
echo '<pre>'; echo $result;
var_export($result);
} catch (Exception $e) { } catch (Exception $e) {
echo $e->getMessage(); echo $e->getMessage();
} }

View File

@ -32,8 +32,7 @@ try {
'total_amount' => '1', // 支付金额 'total_amount' => '1', // 支付金额
'subject' => '支付订单描述', // 支付订单描述 'subject' => '支付订单描述', // 支付订单描述
]); ]);
echo '<pre>'; echo $result;
var_export($result);
} catch (Exception $e) { } catch (Exception $e) {
echo $e->getMessage(); echo $e->getMessage();
} }