PHP code example of moeart / wechat
1. Go to this page and download the library: Download moeart/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/ */
moeart / wechat example snippets
use Stoneworld\Wechat\Server;
$options = array(
'token'=>'stoneworld1992', //填写应用接口的Token
'encodingaeskey'=>'o1wze3492xoUVIc9ccTLJczO3BQ5pLfiHcKwtDEdqM9',//填写加密用的EncodingAESKey
'appid'=>'wx8ac123b21f53dera7', //填写高级调用功能的appid
'appsecret'=>'4ZDHIETJ6e0oENlEkRhYwdKcPcRjCkgQkuHtQTJ12ZhWHESowrJqS9', //填写高级调用功能的密钥
'agentid'=>'5', //应用的id
);
$server = new Server($options);
$server->on('message', function($message){
return "您好!";
});
// 您可以直接echo 或者返回给框架
echo $server->server();