$v) { if ($k != 'sign' && $k != 'sign_type' && $v !== '') { $sign_str .= $k . '=' . $v . '&'; } } $sign_str = rtrim($sign_str, '&'); $params['sign'] = md5($sign_str . $merchant_key); $params['sign_type'] = 'MD5'; // 请求 $ch = curl_init('https://xxkkfz.cn/api/submit.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); return json_decode($response, true); } // 使用示例 $result = epay_submit([ 'pid' => '1001', 'type' => 'alipay', 'out_trade_no' => 'ORDER' . time(), 'notify_url' => 'https://你的域名/notify.php', 'return_url' => 'https://你的域名/return.php', 'name' => '测试商品', 'money' => '0.01', ], '你的商户密钥'); print_r($result);