PHP code example of fushengfu / wechat

1. Go to this page and download the library: Download fushengfu/wechat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fushengfu / wechat example snippets


/**
 * $object work: 企业微信 officialAccount: 公众号 pay: 微信支付 applet:小程序
 *
 */
$app = Factory::make($object, $options);

$app = Factory::make("officialAccount", [
  'appid'=> '*******',//公众号appID
  'secret'=> '3******',//公众号secret
]);

//返回接口响应的原始数据
$response = $app->contactBatchSearch([
  'query_word'=> '南山南'
]);

//返回数组
$arrayResponse = $app->toArray();

//返回 200 网络请求正常
$statusCode = $app->getStatusCode();

//返回 0 则接口响应正常
$errCode = $app->getErrmsg();

//返回true 则请求成功
$ok = $app->Ok();