Thinkphp8集成Alipay Easy SDK for PHP实现支付宝回调验签 日期:2025-02-06 人气:87 使用Alipay Easy SDK for PHP官方的demo无法实现验签,需要将json格式的参数`fund_bill_list`转义 ``` /** * 支付宝异步通知接收服务地址 */ public function alipay() { try { /* 请求数据处理 */ $data = request()->post(); $data = http_build_query($data); $data = explode('&', $data); $new_data = []; foreach ($data as $val) { $rows = explode('=', $val); $new_data[$rows[0]] = urldecode($rows[1]); } if (!empty($new_data['fund_bill_list'])) { $new_data['fund_bill_list'] = str_replace('"', '"', $new_data['fund_bill_list']); $json = json_decode($new_data['fund_bill_list'], true); $new_data['fund_bill_list'] = json_encode($json); } $check = AliPayFacade::checkSign($new_data); // 异步验签 if ($check) { $this->alipayh5Business->handleNotice($new_data); // 处理通知 return 'success'; } else { return 'failure'; } } catch(\Exception $e) { \think\facade\Log::error($e->getMessage()); return 'failure'; } } ``` ### 鸣谢 - [csdn**_枫树林_**](https://blog.csdn.net/qq_26574109/article/details/130998941) 标签: 支付宝 php 上一篇:七棵菜表单快速开发平台二次开发步骤 下一篇:民用多旋翼无人机超视距驾驶员考题(一)公式 随便看看 2025-09-18 七棵菜表单快速开发平台二次开发步骤 2025-09-12 手动更新composer包 2025-08-25 blender4.5实现平面投影切割 2025-08-22 blender4.5.1操作说明 2025-08-19 查看composer所有依赖的 PHP 版本要求 留言