本文整理汇总了PHP中Wechat::getUserList方法的典型用法代码示例。如果您正苦于以下问题:PHP Wechat::getUserList方法的具体用法?PHP Wechat::getUserList怎么用?PHP Wechat::getUserList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wechat
的用法示例。
在下文中一共展示了Wechat::getUserList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNewUser
function getNewUser()
{
ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
import('ORG.wechat');
$options = array('appid' => 'wx35a55b1c419603dc', 'appsecret' => 'ce22a59f9459611c9c38d17721659b95');
$weObj = new Wechat($options);
$userList = $weObj->getUserList();
$page = (int) ceil($userList['total'] / 10000);
//得出有多少页
$userDB = M('user');
$yidong2DB = M('yidong3');
p("start");
foreach ($userList['data']['openid'] as $openid) {
$user = $userDB->where(array('open_id' => $openid))->find();
if ($user == null || $user['id'] > 92214) {
$yidong2['open_id'] = $openid;
//p($openid.'<br/>');
$yidong2DB->data($yidong2)->add();
}
}
for ($i = 1; $i < $page; $i++) {
$userList = $weObj->getUserList($userList['next_openid']);
foreach ($userList['data']['openid'] as $openid) {
$user = $userDB->where(array('open_id' => $openid))->find();
if ($user == null || $user['id'] > 92214) {
$yidong2['open_id'] = $openid;
p($openid . '<br/>');
$yidong2DB->data($yidong2)->add();
}
}
p("*******{$i}*******");
}
p("*******end*******");
exit;
}
示例2: _log
<?php
include "../qy-sdk/wechat.class.php";
function _log($text)
{
//$result = file_put_contents('wechat.log.'.date('Y-m-d'), $text."\n", FILE_APPEND);
//if (!$result) {
openlog("wechat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
syslog(LOG_DEBUG, $text);
closelog();
//}
}
$options = ['token' => 'nizhidaoma', 'encodingaeskey' => 'xc8rRK4iOQjTJK9hOYhRrC9sPBJvF5Jhjq203iMC7vF', 'appid' => 'wxe85832e232e73f41', 'appsecret' => '4c8f1aa381675dd2569fc9482052afdc', 'debug' => true, 'logcallback' => '_log'];
$weObj = new Wechat($options);
$result = $weObj->getUserList();
//$openids = $result['data']['openid'];
$openids = ['okOSbjsFzcUg3UKR8m1rcsDm1LFo', 'okOSbjs8bPyUXm8UiwSe7ohdijCY', 'ogs-bjqeIM4nvT1NKqwM6kO6tonQ', 'ogs-bjlTUqTXyX4JH8TpDrXKZnYs', 'okOSbjrOZwM2wWwxZCHc7OERoYgU', 'okOSbjp_6-rPV5_NL34l8o3IcWTM', 'okOSbjihH2adDfL6Lweb8EPByZZ8', 'okOSbjhkrfGqd-yAQ20ZXHmKyzXw', 'okOSbjuKB0avooLLW7QyyZg2lnKg', 'okOSbjgl8dxxfTQ4CHVXJilFDUXA', 'okOSbjlYWDGvWCh7tNz7IJyIStfY', 'ogs-bjlfxXPVq0eh8pJCdtmUCMz8'];
foreach ($openids as $openid) {
$info = $weObj->getUserInfo($openid);
echo var_export($info, true);
echo '\\n';
}
//echo var_export($result, true);
//echo '\n';
if ($result == false) {
echo $weObj->errCode;
echo '\\n';
echo $weObj->errMsg;
echo '\\n';
}
die;