本文整理汇总了PHP中get_token_appinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP get_token_appinfo函数的具体用法?PHP get_token_appinfo怎么用?PHP get_token_appinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_token_appinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitConfig
/**
* 组装配置信息
* @param $url
* return json
*/
public function InitConfig($url)
{
$info = get_token_appinfo();
//appId $appid = 'wxaa3ddf43e19630ee'; //$secret = '2946a5c98f49087208212f9bcba69379';
$appid = $info['appid'];
$secret = $info['secret'];
//生成签名的时间戳 //生成签名的随机串
$nonceStr = $timestamp = 12345678901;
$access_token = get_access_token();
if (empty($access_token)) {
$auth = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret);
$token = json_decode($auth);
$t = get_object_vars($token);
//转换成数组
$access_token = $t['access_token'];
//输出access_token
}
$jsapi_contents = file_get_contents("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" . $access_token . "&type=jsapi");
$jsapi = json_decode($jsapi_contents);
$j = get_object_vars($jsapi);
$jsapi_ticket = $j['ticket'];
//get JSAPI
$and = "jsapi_ticket=" . $jsapi_ticket . "&noncestr=" . $nonceStr . "×tamp=" . $timestamp . "&url=" . $url . "";
$signature = sha1($and);
$arr['appId'] = $appid;
$arr['timestamp'] = $timestamp;
$arr['nonceStr'] = $nonceStr;
$arr['signature'] = $signature;
echo json_encode($arr);
//输出json数据
}
示例2: reply
function reply($dataArr, $keywordArr = array())
{
$map['id'] = $keywordArr['aim_id'];
$info = M('auto_reply')->where($map)->find();
if ($info['msg_type'] == 'news') {
$map_news['group_id'] = $info['group_id'];
$list = M('material_news')->where($map_news)->select();
$param['publicid'] = get_token_appinfo('', 'id');
foreach ($list as $k => $vo) {
if ($k > 8) {
continue;
}
$articles[] = array('Title' => $vo['title'], 'Description' => $vo['intro'], 'PicUrl' => get_cover_url($vo['cover_id']), 'Url' => $this->_getNewsUrl($vo, $param));
}
$res = $this->replyNews($articles);
} elseif ($info['msg_type'] == 'image') {
if ($info['image_id']) {
// $d['image_id']=url_img_html(get_cover_url($d['image_id']));
$media_id = D('Common/Custom')->get_image_media_id($info['image_id']);
} else {
if ($info['image_material']) {
$map2['id'] = $info['image_material'];
$media_img = M('material_image')->where($map2)->find();
$media_id = $media_img['image_id'];
if (!$media_id) {
$media_id = D('Common/Custom')->get_image_media_id($media_img['cover_id']);
}
}
}
$this->replyImage($media_id);
} else {
$contetn = replace_url(htmlspecialchars_decode($info['content']));
$this->replyText($contetn);
}
}
示例3: bind
function bind()
{
if (defined('IN_WEIXIN') && IN_WEIXIN || isset($_GET['is_stree']) || !C('USER_OAUTH')) {
return false;
}
$isWeixinBrowser = isWeixinBrowser();
if (!$isWeixinBrowser) {
$this->error('请在微信里打开');
}
$info = get_token_appinfo();
$param['appid'] = $info['appid'];
$callback = U('bind');
if ($_GET['state'] != 'weiphp') {
$param['redirect_uri'] = $callback;
$param['response_type'] = 'code';
$param['scope'] = 'snsapi_userinfo';
$param['state'] = 'weiphp';
$info['is_bind'] && ($param['component_appid'] = C('COMPONENT_APPID'));
$url = 'https://open.weixin.qq.com/connect/oauth2/authorize?' . http_build_query($param) . '#wechat_redirect';
redirect($url);
} elseif ($_GET['state'] == 'weiphp') {
if (empty($_GET['code'])) {
exit('code获取失败');
}
$param['code'] = I('code');
$param['grant_type'] = 'authorization_code';
if ($info['is_bind']) {
$param['appid'] = I('appid');
$param['component_appid'] = C('COMPONENT_APPID');
$param['component_access_token'] = D('Addons://PublicBind/PublicBind')->_get_component_access_token();
$url = 'https://api.weixin.qq.com/sns/oauth2/component/access_token?' . http_build_query($param);
} else {
$param['secret'] = $info['secret'];
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?' . http_build_query($param);
}
$content = file_get_contents($url);
$content = json_decode($content, true);
if (!empty($content['errmsg'])) {
exit($content['errmsg']);
}
$url = 'https://api.weixin.qq.com/sns/userinfo?access_token=' . $content['access_token'] . '&openid=' . $content['openid'] . '&lang=zh_CN';
$data = file_get_contents($url);
$data = json_decode($data, true);
if (!empty($data['errmsg'])) {
exit($data['errmsg']);
}
$data['status'] = 2;
empty($data['headimgurl']) && ($data['headimgurl'] = ADDON_PUBLIC_PATH . '/default_head.png');
$uid = D('Common/Follow')->init_follow($content['openid'], $info['token']);
D('Common/User')->updateInfo($uid, $data);
$url = Cookie('__forward__');
if ($url) {
Cookie('__forward__', null);
} else {
$url = U('userCenter');
}
redirect($url);
}
}
示例4: _initialize
public function _initialize()
{
$token = get_token();
$public = get_token_appinfo($token);
$this->appID = trim($public['appid']);
$this->appSecret = trim($public['secret']);
$this->accessToken = get_access_token();
}
示例5: getPackageData
function getPackageData($id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['id'] = $id;
$data['jumpURL'] = addons_url("Xydzp://Xydzp/show", $param);
return $data;
}
示例6: __construct
public function __construct($token = '') {
empty ( $token ) && $token = get_token ();
$info = get_token_appinfo ( $token );
if (empty ( $info ['appid'] )) {
return 0;
}
$this->appId = $info ['appid'];
}
示例7: getPackageData
function getPackageData($id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['id'] = $id;
$data['reserve'] = $this->getInfo($id);
return $data;
}
示例8: personal
function personal()
{
$param['uid'] = $GLOBALS['mid'];
$param['publicid'] = get_token_appinfo('', 'id');
$links = array(array('url' => addons_url('BusinessCard://Wap/detail', $param), 'title' => '我的名片', 'icon' => '', 'group' => '我的互动', 'new_count' => 0), array('url' => addons_url('BusinessCard://Wap/collected', $param), 'title' => '我收藏的名片', 'icon' => '', 'group' => '我的互动', 'new_count' => 0), array('url' => addons_url('BusinessCard://Wap/collecting', $param), 'title' => '收藏我的名片', 'icon' => '', 'group' => '我的互动', 'new_count' => 0));
// new_count 为新消息的数目,如果大于0,会在个人空间里的链接旁边显示新消息数目
// 下面实现获取new_count的功能
return $links;
}
示例9: _initialize
function _initialize()
{
parent::_initialize();
// 使用提示
$param['shop_id'] = $this->shop_id;
$param['publicid'] = get_token_appinfo('', 'id');
$normal_tips = '点击选中下面模板即可实时切换模板,请慎重点击。选择后可点击<a target="_blank" href="' . addons_url('Shop://Wap/index', $param) . '">这里</a>进行预览';
$this->assign('normal_tips', $normal_tips);
}
示例10: lists
function lists()
{
$token = get_token();
$info = get_token_appinfo();
$info['addon_config'] = json_decode($info['addon_config'], true);
$this->assign('info', $info);
$this->assign('token', $token);
// dump ( $info );
$this->display();
}
示例11: getPackageData
function getPackageData($id)
{
$id = I('id', 0, 'intval');
$map['token'] = get_token();
$return['public_info'] = get_token_appinfo($map['token']);
$return['info'] = M('survey')->where($map)->find();
// 添加模板目录
$return['template'] = $return['info']['template'] == "" ? "default" : $return['info']['template'];
return $return;
}
示例12: getPackageData
function getPackageData($vote_id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['vote_id'] = $vote_id;
$data['jumpURL'] = addons_url("Vote://Vote/Vote", $param);
$data['vote'] = $this->getInfo($vote_id);
$data['button_name'] = '马上开始';
return $data;
}
示例13: getPackageData
function getPackageData($ask_id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['ask_id'] = $ask_id;
$data['jumpURL'] = addons_url("Ask://Ask/ask", $param);
$data['ask'] = $this->getAskInfo($ask_id);
$data['button_name'] = '马上开始';
return $data;
}
示例14: getPackageData
function getPackageData($id)
{
$token = get_token();
$return['publicInfo'] = $info = $publicInfo = get_token_appinfo($token);
//$uid = session ( 'mid' );
$param['publicid'] = $info['id'];
$param['id'] = $id = I('id');
$openid = get_openid();
// $return ['canJoin'] = ! empty ( $openid ) && ! empty ( $token ) && ! ($this->_is_overtime ( $id )) && ! ($this->_is_join ( $id, $uid, $token ));
return $return;
}
示例15: index
function index()
{
$id = $map['id'] = I('id', 0, 'intval');
$map['token'] = get_token();
$public_info = get_token_appinfo($map['token']);
$overtime = $this->_is_overtime($id);
$overtime = $overtime ? '1' : '0';
$this->assign('overtime', $overtime);
$info = M('survey')->where($map)->find();
$this->assign('info', $info);
$this->assign('public_info', $public_info);
$this->display();
}