tp5.1 use of micro-channel pay sdk

First, download micro-channel pay sdk

 

Second, copy the file lib folder to the directory: extend-> WxPay

  Modify the file name: WxPay.Api.php-> WxPayApi.php (tp file name must be consistent with the requirements of the class name)

 

Third, set the namespace WxPayApi.php of: namespace WxPay;

  Micro-channel pay: WxPay.Api.php just modify the file name can be, other documents have been introduced in this document inside WxPay.Api.php

 

Fourth, the use WxPayApi normal use this class, as it has been set up to give him a namespace

 

Five examples of other types of files in the category, because WxPayApi class file has a require_once

 

extend description:

1, extend a special directory, it is to place a third-party library files.

2, extend in the class file directory, if not set namespace, tp5.1 automatically be set to the root namespace

     Instantiate this class, you need: $ wxOrderData = new \ WxPayUnifiedOrder ()

    Required before class name with "\", said the class is a global class

3, extend the class file directory, such as: extend-> WxPay-> WxPayApi.php This class file,

  If you set the namespace, he namespace should be set to: namespace WxPay

    If you do not set the namespace can be, the default root namespace

 

Guess you like

Origin www.cnblogs.com/qq254980080/p/11021392.html
Recommended