當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wechat::getUserList方法代碼示例

本文整理匯總了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;
 }
開發者ID:DearMe,項目名稱:zsfb,代碼行數:36,代碼來源:TestAction.class.php

示例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;
開發者ID:adexbn,項目名稱:gds_wechat,代碼行數:31,代碼來源:get_user_list_csc.php


注:本文中的Wechat::getUserList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。