本文整理汇总了PHP中UserInfo::get方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInfo::get方法的具体用法?PHP UserInfo::get怎么用?PHP UserInfo::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Get user media from instagram
*
* @see constructQuery
*
* @param $user_name
* @param null $cursor_after
* @param null $limit
* @return array
*/
public function get($user_name, $cursor_after = NULL, $limit = NULL)
{
if (!$cursor_after) {
$resultObj = new UserInfo($this->client);
$result = $resultObj->get($user_name);
$this->user_id = $result->id;
} else {
$post_params = $this->constructQuery($user_name, $cursor_after, $limit);
$result = $this->asObject($this->client->webRequest('/query/', 'POST', [], $post_params));
}
$media = ['cursor_after' => !empty($result->media->page_info->end_cursor) && !empty($result->media->page_info->has_next_page) ? $result->media->page_info->end_cursor : NULL, 'data' => !empty($result->media->nodes) ? $result->media->nodes : NULL];
return $media;
}
示例2: loadByRequest
if ($rt === false) {
$rt = array('openid' => $this->openid, 'nickname' => '', 'sex' => '', 'city' => '', 'province' => '', 'country' => '', 'headimgurl' => '');
}
$info = (object) $rt;
$sql = "DELETE FROM `wx_userinfo` WHERE `openid` = '{$this->openid}'";
$this->delete($sql);
$sql = "INSERT INTO `wx_userinfo` VALUES ('{$info->openid}', '{$info->nickname}', '{$info->sex}', '{$info->country}', '{$info->province}', '{$info->city}', '{$info->headimgurl}')";
$this->insert($sql);
return $rt;
}
private function loadByRequest()
{
include_once dirname(__FILE__) . '/../token/access_token.php';
include_once dirname(__FILE__) . '/../../util/http_client.php';
$access_token = (new AccessToken())->get();
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$this->openid}&lang=zh_CN";
$info = json_decode((new HttpClient($url))->get(), true);
if (isset($info['subscribe']) && $info['subscribe'] == 1) {
return array('openid' => $info['openid'], 'nickname' => $info['nickname'], 'sex' => $info['sex'], 'city' => $info['city'], 'province' => $info['province'], 'country' => $info['country'], 'headimgurl' => isset($info['headimgurl']) ? $info['headimgurl'] : '');
} else {
return false;
}
}
}
//request by developer
if (isset($_GET['userinfo']) && isset($_GET['secret']) && isset($_GET['openid'])) {
if ($_GET['userinfo'] == APPID && $_GET['secret'] == PRIVATE_SECRET) {
$tmp = new UserInfo($_GET['openid']);
print_r($tmp->get());
}
}
示例3: getByOpenID
/**
* Returns a user object by open ID. Does not log a user in.
* @param string $uOpenID
* @return UserInfo
*/
public function getByOpenID($uOpenID) {
return UserInfo::get('inner join UserOpenIDs on Users.uID = UserOpenIDs.uID where uOpenID = ?', $uOpenID);
}