首先需要下載即時到賬交易介面,傳送門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裡面的代碼,複製如下)
<!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: