Provides various official and user-released code examples. For code reference, you are welcome to learn more about fanwe online payment (based on THINKPHP ).
Put the class in ThinkPHP \ Vendor \ payment3.
include_once(VENDOR_PATH."payment3/chinapay/netpayclient_config.php");
include_once(VENDOR_PATH."payment3/chinapay/netpayclient.php");
Is the configuration file provided by UnionPay.
Add \ app \ source \ index. php
if ($_REQUEST['m']=='ChinapayPayment'){
require ROOT_PATH."app/source/func/com_send_sms_func.php";
require ROOT_PATH."app/source/func/com_order_pay_func.php";
ChinapayIndex();
exit;
}
In \ app \ source \ func \ com_order_pay_func.php, add
Function ChinapayIndex () // UnionPay Processing
{
Require_once (VENDOR_PATH. 'payment3/ChinapayPayment. class. php ');
$ Payment_name = "ChinapayPayment ";
If (class_exists ($ payment_name ))
{
$ Payment_model = new $ payment_name;
$ Res = $ payment_model-> dealResult ($ _ GET, $ _ POST, $ _ REQUEST );
If ($ res ['status'])
{
Echo 'OK ';
}
Else
{
Echo 'error ';
}
} Else
{
Echo 'error ';
}
}
Install it in the background
Source code see: http://www.jakehu.me /? P = 273
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB