本文整理汇总了PHP中get_token_appinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP get_token_appinfo函数的具体用法?PHP get_token_appinfo怎么用?PHP get_token_appinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_token_appinfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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数据
}
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:36,代码来源:WXShareController.class.php
示例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);
}
}
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:35,代码来源:WeixinAddonModel.class.php
示例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);
}
}
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:59,代码来源:WapController.class.php
示例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();
}
开发者ID:walkingmanc,项目名称:weshop,代码行数:8,代码来源:QrCodeModel.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:8,代码来源:XydzpModel.class.php
示例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'];
}
开发者ID:strivi,项目名称:siples,代码行数:8,代码来源:jssdk.php
示例7: getPackageData
function getPackageData($id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['id'] = $id;
$data['reserve'] = $this->getInfo($id);
return $data;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:8,代码来源:ReserveModel.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:9,代码来源:WeixinAddonModel.class.php
示例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);
}
开发者ID:chenpusn,项目名称:guoxian,代码行数:9,代码来源:TemplateController.class.php
示例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();
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:10,代码来源:DeveloperToolController.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:10,代码来源:SurveyModel.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:10,代码来源:VoteOptionModel.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:10,代码来源:AskModel.class.php
示例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;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:11,代码来源:GuessModel.class.php
示例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();
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:13,代码来源:SurveyController.class.php
示例16: index
function index()
{
$id = I('id');
$info = D('CardVouchers')->getInfo($id);
$public_info = get_token_appinfo();
$sha1['timestamp'] = NOW_TIME;
$sha1['appsecre'] = trim($info['appsecre']);
$sha1['card_id'] = $card_id = trim($info['card_id']);
$sha1['signature'] = getSHA1($sha1);
$info['card_ext'] = "{\"code\":\"{$sha1['code']}\",\"openid\":\"{$sha1['openid']}\",\"timestamp\":\"{$sha1['timestamp']}\",\"signature\":\"{$sha1['signature']}\"}";
$this->assign('info', $info);
$this->assign('public_info', $public_info);
$this->display();
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:14,代码来源:WapController.class.php
示例17: index
function index()
{
$info = $publicInfo = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['id'] = $id = I('id');
$openid = get_openid();
$token = get_token();
$followid = $this->mid;
$info = $this->_getGuessInfo($id);
$canJoin = !empty($openid) && !empty($token) && !$this->_is_overtime($id) && !$this->_is_join($id, $followid, $token);
$this->assign('canJoin', $canJoin);
$this->assign('publicInfo', $publicInfo);
$this->display();
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:14,代码来源:GuessController.class.php
示例18: index
function index()
{
$info = $public_info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['ask_id'] = $ask_id = I('id');
$url = addons_url("Ask://Ask/ask", $param);
$ask = D('Ask')->getAskInfo($ask_id);
$this->assign('ask', $ask);
$this->assign('button_name', '马上开始');
$this->assign('jumpURL', $url);
// dump ( $content );
// exit ();
$this->assign('public_info', $public_info);
$this->display();
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:15,代码来源:AskController.class.php
示例19: getPackageData
function getPackageData($id)
{
$info = get_token_appinfo();
$param['publicid'] = $info['id'];
$param['id'] = $id;
$data['jumpURL'] = addons_url("Coupon://Wap/set_sn_code", $param);
$data['info'] = $this->getInfo($id);
// 店铺地址
$maps['coupon_id'] = $id;
$list = M('coupon_shop_link')->where($maps)->select();
$shop_ids = getSubByKey($list, 'shop_id');
if (!empty($shop_ids)) {
$map_shop['id'] = array('in', $shop_ids);
$shop_list = M('coupon_shop')->where($map_shop)->select();
$data['shop_list'] = $shop_list;
}
return $data;
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:18,代码来源:InviteModel.class.php
示例20: getDataByAjax
function getDataByAjax()
{
$min = I('min', 60, 'intval') * 60;
$time = date('YmdHi', NOW_TIME - $min);
$map['publicid'] = get_token_appinfo('', 'id');
$map['time'] = array('gt', $time);
// dump ( $map );
$list = M('online_count')->where($map)->limit(1500)->order('time asc')->select();
// lastsql();
foreach ($list as $v) {
$resy[] = intval($v['count']);
$resx[] = date('H:i', $v['time'] . '00');
}
$resData['x'] = $resx;
$resData['y'] = $resy;
// echo(implode ( ',', $y ));
// echo json_encode ( $res );
$this->ajaxReturn($resData, 'JSON');
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:19,代码来源:TongjiController.class.php
注:本文中的get_token_appinfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论