• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP实现支付宝即时到账功能

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文实例为大家分享了PHP支付宝即时到账功能的实现代码,供大家参考,具体内容如下

首先需要下载即时到账交易接口,传送门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文件复制进去如图所示

然后,打开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里面的代码,复制如下)

  1 <!DOCTYPE html>
  2 <html lang="en">
  3 
  4 <head>
  5     <meta charset="UTF-8">
  6     <title>支付宝即时到账交易接口</title>
  7 </head>
  8 <style>
  9 html,
 10 body {
 11     width: 100%;
 12     min-width: 1200px;
 13     height: auto;
 14     padding: 0;
 15     margin: 0;
 16     font-family: "微软雅黑";
 17     background-color: #242736
 18 }
 19 
 20 .header {
 21     width: 100%;
 22     margin: 0 auto;
 23     height: 230px;
 24     background-color: #fff
 25 }
 26 
 27 .container {
 28     width: 100%;
 29     min-width: 100px;
 30     height: auto
 31 }
 32 
 33 .black {
 34     background-color: #242736
 35 }
 36 
 37 .blue {
 38     background-color: #0ae
 39 }
 40 
 41 .qrcode {
 42     width: 1200px;
 43     margin: 0 auto;
 44     height: 30px;
 45     background-color: #242736
 46 }
 47 
 48 .littlecode {
 49     width: 16px;
 50     height: 16px;
 51     margin-top: 6px;
 52     cursor: pointer;
 53     float: right
 54 }
 55 
 56 .showqrs {
 57     top: 30px;
 58     position: absolute;
 59     width: 100px;
 60     margin-left: -65px;
 61     height: 160px;
 62     display: none
 63 }
 64 
 65 .shtoparrow {
 66     width: 0;
 67     height: 0;
 68     margin-left: 65px;
 69     border-left: 8px solid transparent;
 70     border-right: 8px solid transparent;
 71     border-bottom: 8px solid #e7e8eb;
 72     margin-bottom: 0;
 73     font-size: 0;
 74     line-height: 0
 75 }
 76 
 77 .guanzhuqr {
 78     text-align: center;
 79     background-color: #e7e8eb;
 80     border: 1px solid #e7e8eb
 81 }
 82 
 83 .guanzhuqr img {
 84     margin-top: 10px;
 85     width: 80px
 86 }
 87 
 88 .shmsg {
 89     margin-left: 10px;
 90     width: 80px;
 91     height: 16px;
 92     line-height: 16px;
 93     font-size: 12px;
 94     color: #242323;
 95     text-align: center
 96 }
 97 
 98 .nav {
 99     width: 1200px;
100     margin: 0 auto;
101     height: 70px;
102 }
103 
104 .open,
105 .logo {
106     display: block;
107     float: left;
108     height: 40px;
109     width: 85px;
110     margin-top: 20px
111 }
112 
113 .divier {
114     display: block;
115     float: left;
116     margin-left: 20px;
117     margin-right: 20px;
118     margin-top: 23px;
119     width: 1px;
120     height: 24px;
121     background-color: #d3d3d3
122 }
123 
124 .open {
125     line-height: 30px;
126     font-size: 20px;
127     text-decoration: none;
128     color: #1a1a1a
129 }
130 
131 .navbar {
132     float: right;
133     width: 200px;
134     height: 40px;
135     margin-top: 15px;
136     list-style: none
137 }
138 
139 .navbar li {
140     float: left;
141     width: 100px;
142     height: 40px
143 }
144 
145 .navbar li a {
146     display: inline-block;
147     width: 100px;
148     height: 40px;
149     line-height: 40px;
150     font-size: 16px;
151     color: #1a1a1a;
152     text-decoration: none;
153     text-align: center
154 }
155 
156 .navbar li a:hover {
157     color: #00AAEE
158 }
159 
160 .title {
161     width: 1200px;
162     margin: 0 auto;
163     height: 80px;
164     line-height: 80px;
165     font-size: 20px;
166     color: #FFF
167 }
168 
169 .content {
170     width: 100%;
171     min-width: 1200px;
172     height: 660px;
173     background-color: #fff;
174 }
175 
176 .alipayform {
177     width: 800px;
178     margin: 0 auto;
179     height: 600px;
180     border: 1px solid #0ae
181 }
182 
183 .element {
184     width: 600px;
185     height: 80px;
186     margin-left: 100px;
187     font-size: 20px
188 }
189 
190 .etitle,
191 .einput {
192     float: left;
193     height: 26px
194 }
195 
196 .etitle {
197     width: 150px;
198     line-height: 26px;
199     text-align: right
200 }
201 
202 .einput {
203     width: 200px;
204     margin-left: 20px
205 }
206 
207 .einput input {
208     width: 398px;
209     height: 24px;
210     border: 1px solid #0ae;
211     font-size: 16px
212 }
213 
214 .mark {
215     margin-top: 10px;
216     width: 
                       
                    
                    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP 3:从Login界面谈PHP标记发布时间:2022-07-10
下一篇:
PHP采集利器:Snoopy发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap