PHP code example of mr_litt / wechat

1. Go to this page and download the library: Download mr_litt/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/ */

    

mr_litt / wechat example snippets


 

chat\Application;

$options = [
    'app_id' => '123456',
    'secret' => '123456789',
    'token'  => 'wechat',
    'debug'     => true, //调试模式,默认false
    'log' => [
        'level' => 'info',  //调试模式记录级别,默认info
        'path'  => __DIR__.'/wechat.log',   //日志保存文件,默认/tmp/app.log
    ],
];

$app = new Application($options);
$response = $app->response; //获取respomse对象
$response->setMessageHandler("欢迎光临!");  //设置返回信息
$response->send();