您的位置:首页 > 移动开发 > 微信开发

微信

2016-03-10 12:16 330 查看
<?php
namespace Home\Controller;
use Think\Controller;
use Com\Wechat;
use Com\WechatAuth;
class IndexController extends Controller {
public function index()
{
$token="weixin";
$Wechat=new Wechat($token);
$data=$Wechat->request();
if($data&&is_array($data))
{
switch ($data['MsgType']) {
case 'text':
$this->Text($Wechat,$data);
break;
case 'image':
$this->replayphoto($Wechat,$data);
default:

break;
}
}
}
public function Text($Wechat,$data)
{
$Wechat->replyText($data['Content']);
}
public function replayphoto($Wechat,$data)
{
$Wechat->replyImage($data['MediaId']);
}

}
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: