<?php /** * Created by PhpStorm. * User: hundredlee * Date: 1/7/16 * Time: 9:01 AM */ error_reporting(0); require 'WeChat.php'; define('MAX_GROUP_NUM', 35); $weChat = new WeChat(); //设置uuid $weChat->setUuid(); echo $weChat->getQRCode(); echo '<br/>'; sleep(2); while (true) { if ($weChat->waitForLogin() == 200) { break; } } echo '<br/>'; if (!$weChat->login()) { echo '登录失败!<br/>'; return; } else { echo '登录成功!<br/>'; } if (!$weChat->weChatInitial()) { echo '初始化失败!<br/>';
<?php require './WeChat.class.php'; define('APPID', 'wxe647b92b9dc39f1b'); define('APPSECRET', 'e16374d53b5b78bf25fd7e29e3d58c46'); define('TOKEN', 'itcast_php34'); $wechat = new WeChat(APPID, APPSECRET, TOKEN); $wechat->getQRCode(42, NULL);