http 支付宝验证

This commit is contained in:
“wanyongkang”
2024-01-13 17:53:16 +08:00
parent bb734ba307
commit b8ee644f8a

View File

@@ -2,7 +2,7 @@
/* /*
* @Author: 万永康 * @Author: 万永康
* @Date: 2020-10-11 12:32:50 * @Date: 2020-10-11 12:32:50
* @LastEditTime: 2024-01-13 17:43:30 * @LastEditTime: 2024-01-13 17:52:59
* @LastEditors: “wanyongkang” “937888580@qq.com” * @LastEditors: “wanyongkang” “937888580@qq.com”
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /phptest/alipay/Alipay.php * @FilePath: /phptest/alipay/Alipay.php
@@ -192,20 +192,19 @@ class Alipay
public static function payVerify2($post) { public static function payVerify2($post) {
global $config; global $config;
$aop = new \AopClient(); $aop = new \AopClient();
$aop->postCharset="UTF-8";
$aop->alipayrsaPublicKey = $config['alipay2']['public_key']; $aop->alipayrsaPublicKey = $config['alipay2']['public_key'];
//签名方式 // //签名方式
$sign_type="RSA2"; // $sign_type="RSA2";
$data = explode('&', $post); // $data = explode('&', $post);
$params = array(); // $params = array();
foreach ($data as $param) { // foreach ($data as $param) {
$item = explode('=', $param,"2"); // $item = explode('=', $param,"2");
$params[$item[0]] = $item[1]; // $params[$item[0]] = $item[1];
} // }
//输出拆分后的数据数据 //输出拆分后的数据数据
//验签代码 //验签代码
$flag = $aop->rsaCheckV1($params, null, $sign_type); $flag = $aop->rsaCheckV1($_POST, NULL, "RSA2");
if ($flag) if ($flag)
{ {