Esempio n. 1
0
    if ($weChat->waitForLogin() == 200) {
        break;
    }
}
echo '<br/>';
if (!$weChat->login()) {
    echo '登录失败!<br/>';
    return;
} else {
    echo '登录成功!<br/>';
}
if (!$weChat->weChatInitial()) {
    echo '初始化失败!<br/>';
    return;
}
$memberList = array_values($weChat->webwxgetcontact());
$memberCount = count($memberList) - 1;
echo "你的微信里目前有 " . $memberCount . " 个好友<br/>";
$groupNumber = ceil($memberCount / MAX_GROUP_NUM);
$chatRoomName = '';
for ($i = 0; $i < $groupNumber; $i++) {
    $usernames = array();
    $nicknames = array();
    for ($j = 0; $j < MAX_GROUP_NUM; $j++) {
        if ($i * MAX_GROUP_NUM + $j >= $memberCount) {
            break;
        }
        $member = $memberList[$i + MAX_GROUP_NUM + $j];
        $usernames[] = $member['UserName'];
        $nicknames[] = $member['NickName'];
    }