PHP code example of beacon / wechat

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

    

beacon / wechat example snippets


  

  



use Overtrue\Wechat\Server;

$appId = 'wx3cf0f39249eb0e60';
$token = "overtrue";

$server = new Server($appId, $token);

$server->on('message', function($message){
    return "您好!欢迎关注 overtrue!";
});

// 您可以直接echo 或者返回给框架
echo $server->serve();