php支付宝接口用法分析

前端之家收集整理的这篇文章主要介绍了php支付宝接口用法分析前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了PHP支付宝接口用法分享给大家供大家参考。具体分析如下:

现在流行的网站支持平台,支付宝当仁不让的老大了,现在我们就来告诉你如何使用支付宝api来做第三方支付,把支付宝放到自己网站来,代码如下:

alipay_config.PHP配置程序如下:

代码如下:
alipay.PHP代码如下:
代码如下:
//alipay.php代码
require_once("alipay_config.php");
class alipay
{
function geturl($s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11,$s12,$s13,$s14,$s15,$s16,$s17,$s18,$s19,$s20,$s21,$s22,$s23)
{
$parameter = array(
'cmd' => $s1,
'subject' => $s2,
'body' => $s3,
'order_no' => $s4,
'price' => $s5,
'url' => $s6,
'type' => $s7,
'number' => $s8,
'transport' => $s9,
'ordinary_fee' => $s10,
'express_fee' => $s11,
'readonly' => $s12,
'buyer_msg' => $s13,
'seller' => $s14,
'buyer' => $s15,
'buyer_name' => $s16,
'buyer_address' => $s17,
'buyer_zipcode' => $s18,
'buyer_tel' => $s19,
'buyer_mobile' => $s20,
'partner' => $s21,
);

$url = $s22.$s14."?";
foreach($parameter as $key => $value){
if($value){
$url .= $key."=".urlencode($value)."&";
$acsouce .=$key.$value;
}
}
$url .= 'ac='.md5($acsouce.$s23);
return $url;

}
}
?>

pay.PHP页面如下:
<div class="codetitle"><a style="CURSOR: pointer" data="40741" class="copybut" id="copybut40741" onclick="doCopy('code40741')"> 代码如下:

<div class="codebody" id="code40741"><?PHP
error_reporting(0);
$aliname=$_POST["aliname"];
$alizipcode=$_POST["alizipcode"];
$aliphone=$_POST["aliphone"];
$aliaddress=$_POST["aliaddress"];
$aliorder=$_POST["aliorder"];
$alimailtype=$_POST["alimailtype"];
$alimoney=$_POST["alimoney"];
$alimob=$_POST["alimob"];
$alibody=$_POST["alibody"];

require_once("alipay_config.PHP"); require_once("alipay.PHP");

$cmd = '0001';
$subject = "订单号:".$aliorder;
$body = '商品介绍';
$order_no = $aliorder;
$price = $alimoney;
$url = 'www.jb51.cc';//你的网址
$type = '1';
$number = '1';
$transport = $alimailtype;
$ordinary_fee = '0.00';
$express_fee = '0.00';
$readonly = 'true';
$buyer_msg = $alibody;
$seller = $selleremail;
$buyer = '';
$buyer_name = $aliname;
$buyer_address = $aliaddress;
$buyer_zipcode = $alizipcode;
$buyer_tel = $aliphone;
$buyer_mobile = $alimob;
$partner = '2088002008096997';

$geturl = new alipay;
$link = $geturl->geturl
(
$cmd,$subject,$body,$order_no,$price,$url,$type,$number,$transport,
$ordinary_fee,$express_fee,$readonly,$buyer_msg,$seller,$buyer,
$buyer_name,$buyer_address,$buyer_zipcode,$buyer_tel,$buyer_mobile,$partner,
$interfaceurl,$payalikey
);
?>

简易支付宝付款<a href="/tag/PHP/" target="_blank" class="keywords">PHP</a>版 <Meta http-equiv=content-type content="text/html; charset=gb2312">

简易支付宝付款PHP

(1.平邮 2.快递 3.虚拟物品) 修改订单">

希望本文所述对大家的PHP程序设计有所帮助。

猜你在找的PHP相关文章