アリペイ契約免除手数料支払いインタフェースAPI

31378 ワード

アリペイ契約免除手数料支払いインタフェースAPI
PHPの友达はこの原理を理解することができて开発したい自分が开発することができることを见て1つのありがとうございます支持
データベース接続
  1. // PHP    
  2.  // mysql
  3. require_once ('mysql.class.php');
  4.  //
  5. define("host","localhost");  //
  6. define("user","root");       //
  7. define("pwd","123456");      //
  8. define("dbname","qz");    //
  9. $mysql = new MySQL(host,user,pwd,dbname);
  10.  @mysql_query("set names 'utf8'");
PHP API
  1. header('Content-type: text/html; charset=utf8');
  2. $sel=require 'db.php'; //
  3.  @mysql_query("set names 'utf8'");
  4. date_default_timezone_set('Asia/Shanghai');
  5. $time=date('Y-m-d H:i:s',time());
  6.  // GET
  7. $us=htmlspecialchars($_GET['us'],ENT_NOQUOTES);//
  8. $pw=htmlspecialchars($_GET['pw'],ENT_NOQUOTES);//
  9. $out_trade_no=htmlspecialchars($_GET['out_trade_no'],ENT_NOQUOTES);//
  10. $subject=htmlspecialchars($_GET['subject'],ENT_NOQUOTES);//
  11. $total_fee=htmlspecialchars($_GET['total_fee'],ENT_NOQUOTES);//
  12. $pay_time=htmlspecialchars($_GET['pay_time'],ENT_NOQUOTES);//
  13.  
  14.  //
  15.  if($us!==" "){exit($time."  ");}
  16.  if($pw!==" "){exit($time."  ");}
  17.  
  18.  // , , , ,
  19. $select_out_trade_no=$mysql->table('xz_pay')->where('out_trade_no='.$out_trade_no)->select();
  20.  if(!$select_out_trade_no){
  21.  
  22.  //
  23. $arr['out_trade_no'] = $out_trade_no;
  24. $arr['subject']      = $subject;
  25. $arr['total_fee']    = $total_fee;
  26. $arr['pay_time']     = $pay_time;
  27. $sql_add=$mysql->data($arr)->table('xz_pay')->add();
  28.  if($sql_add){echo $time."  {$subject}- ";}else{echo $time."  {$subject}- ";}
  29.  
  30.  // ( )     
  31.  //subject    
  32. $select_subject=$mysql->table(' ')->where('subject='.$subject)->select();
  33.  //  
  34.  if(!$select_subject){exit("- ");}
  35.  //    
  36. $update_subject=$mysql->table(' ')->data(array(' '=>' '))->where('id=XXX ')->update();
  37.  if($update_subject){echo"- ";}else{echo"- ";}
  38.  // SQL  , ,
  39.  
  40. $update_subject=$mysql->table(' ')->data(array(' '=>' '))->where('subject='.$subject)->update();
  41.  if($update_subject){echo"- ";}else{echo"- ";}
  42.  
  43.  }