``` <?php // 验证 $data = $_REQUEST; $sign = ''; ksort($data); foreach ($data as $k => $v) { if($v && $k !== 'sign' && $k !== 'sign_type') $sign .= $k . '=' . $v . '&'; } $sign = md5(rtrim($sign, '&') . '你的KEY'); if($sign == $data['sign']) { // 验签成功! } // 发起 $param = [ 'pid'=>'123456', 'name'=>'cs', 'type'=>'alipay', 'money'=>'0.01', 'out_trade_no'=>'123456', 'notify_url'=>'https://api.fcypay.cn', 'return_url'=>'https://api.fcypay.cn', 'sitename'=>'123456', 'sign_type'=>'MD5', ]; $key = '123456'; $url = 'https://api.fcypay.cn/api/payment'; ksort($param); $sign = ''; foreach ($param as $k => $v) { if($v && $k !== 'sign' && $k !== 'sign_type'){ $sign.=$k.'='.$v.'&'; } } $sign = trim($sign,'&'); $param['sign'] = md5($sign.$key); ```