人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁      樂道系統(tǒng)FAQ      PHP實現(xiàn)支付寶即時到賬功能

PHP實現(xiàn)支付寶即時到賬功能

標簽: 發(fā)布日期:2016-12-21 00:00:00 296
【CLI】利用Curl下載文件實時進度條顯示的實現(xiàn)

本文實例為大家分享了PHP支付寶即時到賬功能的實現(xiàn)代碼,供大家參考,具體內(nèi)容如下

首先需要下載即時到賬交易接口,傳送門https://doc.open.alipay.com/doc2/detail?treeId=62&articleId=103566&docType=1

選擇(create_direct_pay_by_user)

然后解壓,選擇MD5簽名版本的文件

此文件夾里有個叫create_direct_pay_by_user-PHP-UTF-8的文件,我們就用這個文件~

接著打開文件后如圖


并把文件夾lib里面的四個PHP文件重命名

alipay_core.function.php重命名為:Corefunction.php;

alipay_md5.function.php重命名為:Md5function.php;

alipay_notify.class.php重命名為:Notify.php;

alipay_submit.class.php重命名為:Submit.php;

最后在THINKPHP\Library\Vendor目錄下新建文件夾命名為Alipay,把以上四個php文件復(fù)制進去如圖所示

然后,打開Submit.php文件,把以下代碼去掉;

require_once("alipay_core.function.php");
require_once("alipay_md5.function.php");

同樣,打開Notify.php文件,把以下兩段代碼去掉;

require_once("alipay_core.function.php");
require_once("alipay_md5.function.php");

接下來可以寫代碼了(注意img文件夾里的圖片地址需要修改)

HTML代碼:(這個代碼其實就是index里面的代碼,復(fù)制如下)

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>支付寶即時到賬交易接口</title>
</head>

<style>
 html,body {
 width:100%;
 min-width:1200px;
 height:auto;
 padding:0;
 margin:0;
 font-family:"微軟雅黑";
 background-color:#242736
 }
 .header {
 width:100%;
 margin:0 auto;
 height:230px;
 background-color:#fff
 }
 .container {
 width:100%;
 min-width:100px;
 height:auto
 }
 .black {
 background-color:#242736
 }
 .blue {
 background-color:#0ae
 }
 .qrcode {
 width:1200px;
 margin:0 auto;
 height:30px;
 background-color:#242736
 }
 .littlecode {
 width:16px;
 height:16px;
 margin-top:6px;
 cursor:pointer;
 float:right
 }
 .showqrs {
 top:30px;
 position:absolute;
 width:100px;
 margin-left:-65px;
 height:160px;
 display:none
 }
 .shtoparrow {
 width:0;
 height:0;
 margin-left:65px;
 border-left:8px solid transparent;
 border-right:8px solid transparent;
 border-bottom:8px solid #e7e8eb;
 margin-bottom:0;
 font-size:0;
 line-height:0
 }
 .guanzhuqr {
 text-align:center;
 background-color:#e7e8eb;
 border:1px solid #e7e8eb
 }
 .guanzhuqr img {
 margin-top:10px;
 width:80px
 }
 .shmsg {
 margin-left:10px;
 width:80px;
 height:16px;
 line-height:16px;
 font-size:12px;
 color:#242323;
 text-align:center
 }
 .nav {
 width:1200px;
 margin:0 auto;
 height:70px;
 }
 .open,.logo {
 display:block;
 float:left;
 height:40px;
 width:85px;
 margin-top:20px
 }
 .divier {
 display:block;
 float:left;
 margin-left:20px;
 margin-right:20px;
 margin-top:23px;
 width:1px;
 height:24px;
 background-color:#d3d3d3
 }
 .open {
 line-height:30px;
 font-size:20px;
 text-decoration:none;
 color:#1a1a1a
 }
 .navbar {
 float:right;
 width:200px;
 height:40px;
 margin-top:15px;
 list-style:none
 }
 .navbar li {
 float:left;
 width:100px;
 height:40px
 }
 .navbar li a {
 display:inline-block;
 width:100px;
 height:40px;
 line-height:40px;
 font-size:16px;
 color:#1a1a1a;
 text-decoration:none;
 text-align:center
 }
 .navbar li a:hover {
 color:#00AAEE
 }
 .title {
 width:1200px;
 margin:0 auto;
 height:80px;
 line-height:80px;
 font-size:20px;
 color:#FFF
 }
 .content {
 width:100%;
 min-width:1200px;
 height:660px;
 background-color:#fff;
 }
 .alipayform {
 width:800px;
 margin:0 auto;
 height:600px;
 border:1px solid #0ae
 }
 .element {
 width:600px;
 height:80px;
 margin-left:100px;
 font-size:20px
 }
 .etitle,.einput {
 float:left;
 height:26px
 }
 .etitle {
 width:150px;
 line-height:26px;
 text-align:right
 }
 .einput {
 width:200px;
 margin-left:20px
 }
 .einput input {
 width:398px;
 height:24px;
 border:1px solid #0ae;
 font-size:16px
 }
 .mark {
 margin-top: 10px;
 width:500px;
 height:30px;
 margin-left:80px;
 line-height:30px;
 font-size:12px;
 color:#999
 }
 .legend {
 margin-left:100px;
 font-size:24px
 }
 .alisubmit {
 width:400px;
 height:40px;
 border:0;
 background-color:#0ae;
 font-size:16px;
 color:#FFF;
 cursor:pointer;
 margin-left:170px
 }
 .footer {
 width:100%;
 height:120px;
 background-color:#242735
 }
 .footer-sub a,span {
 color:#808080;
 font-size:12px;
 text-decoration:none
 }
 .footer-sub a:hover {
 color:#00aeee
 }
 .footer-sub span {
 margin:0 3px
 }
 .footer-sub {
 padding-top:40px;
 height:20px;
 width:600px;
 margin:0 auto;
 text-align:center
 }
</style>

<body>

<div class="header">
 <div class="container black">
 <div class="qrcode">
 <div class="littlecode">
 <img width="16px" src="img/little_qrcode.jpg" id="licode">
 <div class="showqrs" id="showqrs">
  <div class="shtoparrow"></div>
  <div class="guanzhuqr">
  <img src="img/guanzhu_qrcode.png" width="80">
  <div class="shmsg" style="margin-top:5px;">
  請掃碼關(guān)注
  </div>
  <div class="shmsg" style="margin-bottom:5px;">
  接收重要信息
  </div>
  </div>
 </div>
 </div>
 </div>
 </div>
 <div class="container">
 <div class="nav">
 <a  class="logo"><img src="img/alipay_logo.png" height="30px"></a>
 <span class="divier"></span>
 <a  class="open" target="_blank">開放平臺</a>
 <ul class="navbar">
 <li><a  target="_blank">在線文檔</a></li>
 <li><a  target="_blank">技術(shù)支持</a></li>
 </ul>
 </div>
 </div>
 <div class="container blue">
 <div class="title">支付寶即時到賬(create_direct_pay_by_user)</div>
 </div>
</div>
<div class="content">
 <form action="{:U('home/Pay/alipayapi')}" class="alipayform" method="post" target="_blank">
 <div class="element" style="margin-top:60px;">
 <div class="legend">支付寶即時到賬交易接口快速通道 </div>
 </div>
 <div class="element">
 <div class="etitle">商戶訂單號:</div>
 <div class="einput"><input type="text" name="WIDout_trade_no" id="out_trade_no"></div>
 <br>
 <div class="mark">注意:商戶訂單號(out_trade_no).必填(建議是英文字母和數(shù)字,不能含有特殊字符)</div>
 </div>

 <div class="element">
 <div class="etitle">商品名稱:</div>
 <div class="einput"><input type="text" name="WIDsubject" value="test商品123"></div>
 <br>
 <div class="mark">注意:產(chǎn)品名稱(subject),必填(建議中文,英文,數(shù)字,不能含有特殊字符)</div>
 </div>
 <div class="element">
 <div class="etitle">付款金額:</div>
 <div class="einput"><input type="text" name="WIDtotal_fee" value="0.01"></div>
 <br>
 <div class="mark">注意:付款金額(total_fee),必填(格式如:1.00,請精確到分)</div>
 </div>
 <div class="element">
 <div class="etitle">商品描述:</div>
 <div class="einput"><input type="text" name="WIDbody" value="即時到賬測試"></div>
 <br>
 <div class="mark">注意:商品描述(body),選填(建議中文,英文,數(shù)字,不能含有特殊字符)</div>
 </div>
 <div class="element">
 <input type="submit" class="alisubmit" value ="確認支付">
 </div>
 </form>
</div>
<div class="footer">
 <p class="footer-sub">
 <a  target="_blank">關(guān)于支付寶</a><span>|</span>
 <a  target="_blank">商家中心</a><span>|</span>
 <a  target="_blank">誠征英才</a><span>|</span>
 <a  target="_blank">聯(lián)系我們</a><span>|</span>
 <a href="#" id="international" target="_blank">International Business</a><span>|</span>
 <a  target="_blank">About Alipay</a>
 <br>
 <span>支付寶版權(quán)所有</span>
 <span class="footer-date">2004-2016</span>
 <span><a  target="_blank">ICP證:滬B2-20150087</a></span>
 </p>


</div>
</body>
<script>
 var even = document.getElementById("licode");
 var showqrs = document.getElementById("showqrs");
 even.onmouseover = function(){
 showqrs.style.display = "block";
 }
 even.onmouseleave = function(){
 showqrs.style.display = "none";
 }

 var out_trade_no = document.getElementById("out_trade_no");

 //設(shè)定時間格式化函數(shù)
 Date.prototype.format = function (format) {
 var args = {
 "M+": this.getMonth() + 1,
 "d+": this.getDate(),
 "h+": this.getHours(),
 "m+": this.getMinutes(),
 "s+": this.getSeconds(),
 };
 if (/(y+)/.test(format))
 format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 for (var i in args) {
 var n = args[i];
 if (new RegExp("(" + i + ")").test(format))
 format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length));
 }
 return format;
 };

 out_trade_no.value = 'test'+ new Date().format("yyyyMMddhhmmss");
</script>
</html>