tp框架中集成支付宝的功能,将支付宝的demo例子存在到下图位置ExtendVendorAlipay

  生成支付订单
/**
*支付订单
*/
publicfunctionpay(){
header("Content-Type:text/html;charset=utf-8");
$id=I('post.oid','','htmlspecialchars');
$DAO=M('order');
$order=$DAO->where("id=".$id)->find();
$error="";
if(!isset($order)){
$error="订单不存在";
}elseif($order['PaymentStatus']==1){
$error="此订单已经完成,无需再次支付!";
}elseif($order['PaymentStatus']==2){
$error="此订单已经取消,无法支付,请重新下单!";
}
if($error!=""){
$this->_FAIL("系统错误",$error,$this->getErrorLinks());
return;
}
$payType=I('post.payType','','htmlspecialchars');
#支付宝
if($payType=='alipay'){
$this->payWithAlipay($order);
}
}