微信支付插件优化
parent
5156d34b6a
commit
12dbcf79bc
|
|
@ -694,14 +694,24 @@ class Weixin
|
|||
$apiclient_cert_file = ROOT.'runtime'.DS.'temp'.DS.'payment_weixin_pay_apiclient_cert.pem';
|
||||
$apiclient_key_file = ROOT.'runtime'.DS.'temp'.DS.'payment_weixin_pay_apiclient_key.pem';
|
||||
|
||||
$apiclient_cert = "-----BEGIN CERTIFICATE-----\n";
|
||||
$apiclient_cert .= wordwrap($this->config['apiclient_cert'], 64, "\n", true);
|
||||
$apiclient_cert .= "\n-----END CERTIFICATE-----";
|
||||
if(stripos($this->config['apiclient_cert'], '-----') === false)
|
||||
{
|
||||
$apiclient_cert = "-----BEGIN CERTIFICATE-----\n";
|
||||
$apiclient_cert .= wordwrap($this->config['apiclient_cert'], 64, "\n", true);
|
||||
$apiclient_cert .= "\n-----END CERTIFICATE-----";
|
||||
} else {
|
||||
$apiclient_cert = $this->config['apiclient_cert'];
|
||||
}
|
||||
file_put_contents($apiclient_cert_file, $apiclient_cert);
|
||||
|
||||
$apiclient_key = "-----BEGIN PRIVATE KEY-----\n";
|
||||
$apiclient_key .= wordwrap($this->config['apiclient_key'], 64, "\n", true);
|
||||
$apiclient_key .= "\n-----END PRIVATE KEY-----";
|
||||
if(stripos($this->config['apiclient_key'], '-----') === false)
|
||||
{
|
||||
$apiclient_key = "-----BEGIN PRIVATE KEY-----\n";
|
||||
$apiclient_key .= wordwrap($this->config['apiclient_key'], 64, "\n", true);
|
||||
$apiclient_key .= "\n-----END PRIVATE KEY-----";
|
||||
} else {
|
||||
$apiclient_key = $this->config['apiclient_key'];
|
||||
}
|
||||
file_put_contents($apiclient_key_file, $apiclient_key);
|
||||
|
||||
return ['cert' => $apiclient_cert_file, 'key' => $apiclient_key_file];
|
||||
|
|
|
|||
Loading…
Reference in New Issue