项目中引入easywechat
使用composer安装
$ composer require overtrue/wechat:~4.0 -vvv
配置easychat的config
use EasyWeChat\Factory;
$config = [
'app_id' => '',//微信appId
'secret' => '',//微信秘钥
// 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
'response_type' => 'array',
//...
];
$app = Factory::officialAccount($config);公众号
代码实现
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>分享按钮测试</title>
</head>
<body>
<div>
<p>测试微信分享功能</p>
</div>
<script src="/kandian/js/jquery.1.8.3.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.5.0.js">&