当前位置: 首页>>代码示例>>PHP>>正文


PHP get_token函数代码示例

本文整理汇总了PHP中get_token函数的典型用法代码示例。如果您正苦于以下问题:PHP get_token函数的具体用法?PHP get_token怎么用?PHP get_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_token函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testReturnsFormattedUriFromRequestObject

 public function testReturnsFormattedUriFromRequestObject()
 {
     $request = new Shows(get_token(), Carbon::now(), 7);
     $formattedUri = UriBuilder::format($request);
     $this->assertContains($formattedUri, $formattedUri);
     $this->assertContains(Carbon::now()->format("Y-m-d"), $formattedUri);
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:7,代码来源:UriBuilderTest.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->token = get_token();
     $this->wecha_id = get_openid();
     // 读取配置
     $pay_config_db = M('payment_set');
     $paymentSet = $pay_config_db->where(array('token' => $this->token))->find();
     if ($paymentSet['wx_cert_pem'] && $paymentSet['wx_key_pem']) {
         $ids[] = $paymentSet['wx_cert_pem'];
         $ids[] = $paymentSet['wx_key_pem'];
         $map['id'] = array('in', $ids);
         $fileData = M('file')->where($map)->select();
         $downloadConfig = C(DOWNLOAD_UPLOAD);
         foreach ($fileData as $f) {
             if ($paymentSet['wx_cert_pem'] == $f['id']) {
                 $certpath = SITE_PATH . str_replace('/', '\\', substr($downloadConfig['rootPath'], 1) . $f['savepath'] . $f['savename']);
             } else {
                 $keypath = SITE_PATH . str_replace('/', '\\', substr($downloadConfig['rootPath'], 1) . $f['savepath'] . $f['savename']);
             }
         }
         $paymentSet['cert_path'] = $certpath;
         $paymentSet['key_path'] = $keypath;
     }
     $this->payConfig = $paymentSet;
     session('paymentinfo', $this->payConfig);
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:27,代码来源:WeixinController.class.php

示例3: reply

 function reply($dataArr, $keywordArr = array())
 {
     $map['id'] = $keywordArr['aim_id'];
     $param['token'] = get_token();
     $param['openid'] = get_openid();
     if ($keywordArr['extra_text'] == 'custom_reply_mult') {
         // 多图文回复
         $mult = M('custom_reply_mult')->where($map)->find();
         $map_news['id'] = array('in', $mult['mult_ids']);
         $list = M('custom_reply_news')->where($map_news)->select();
         foreach ($list as $k => $info) {
             if ($k > 8) {
                 continue;
             }
             $articles[] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         }
         $res = $this->replyNews($articles);
     } elseif ($keywordArr['extra_text'] == 'custom_reply_news') {
         // 单条图文回复
         $info = M('custom_reply_news')->where($map)->find();
         // 组装微信需要的图文数据,格式是固定的
         $articles[0] = array('Title' => $info['title'], 'Description' => $info['intro'], 'PicUrl' => get_cover_url($info['cover']), 'Url' => $this->_getNewsUrl($info, $param));
         $res = $this->replyNews($articles);
     } else {
         // 增加积分
         add_credit('custom_reply', 300);
         // 文本回复
         $info = M('custom_reply_text')->where($map)->find();
         $contetn = replace_url(htmlspecialchars_decode($info['content']));
         $this->replyText($contetn);
     }
 }
开发者ID:noikiy,项目名称:weiphp,代码行数:32,代码来源:WeixinAddonModel.class.php

示例4: credit_data

 function credit_data()
 {
     $model = $this->getModel('credit_data');
     $map['token'] = get_token();
     session('common_condition', $map);
     parent::common_lists($model, 0, 'Addons/lists');
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:7,代码来源:CreditController.class.php

示例5: formText

 private function formText($user, $config)
 {
     if (!$user) {
         return '请先回复绑定并绑定真实信息以使用本功能.';
     }
     if ($user['user_type'] == 1) {
         return '老师是没有考试成绩的0.0';
     } else {
         $textArr = array();
         $userGrades = M('cjcx')->where(array('school_id' => $user['school_id'], 'term' => $config['term']))->select();
         if (0 == count($userGrades)) {
             return "空记录! 还没有更新呢!";
         }
         foreach ($userGrades as $item) {
             $_t = '';
             $_t .= "课程名称: {$item['course_name']},\n";
             $_t .= "课程属性: {$item['class_type']}, \n";
             $_t .= "学分: {$item['study_score']},\n";
             $_t .= "分数: {$item['stu_grade']}";
             array_push($textArr, $_t);
         }
         $basic = implode("\n\n", $textArr);
         $params['openid'] = get_openid();
         $params['token'] = get_token();
         $more = "\n\n" . "<a href='" . addons_url("Cjcx://Cjcx/center", $params) . "'>查看完整记录</a>";
         return $basic . $more;
     }
 }
开发者ID:amotewangrong,项目名称:WeiPHP-SWXZS,代码行数:28,代码来源:WeixinAddonModel.class.php

示例6: init_follow

 function init_follow($openid, $token = '', $has_subscribe = false)
 {
     empty($token) && ($token = get_token());
     addWeixinLog($openid . '::_' . $token, 'init_follow_in');
     if (empty($openid) || $openid == -1 || empty($token) || $token == -1) {
         return false;
     }
     $data['token'] = $token;
     $data['openid'] = $openid;
     $datas = $data;
     $uid = M('public_follow')->where($data)->getField('uid');
     addWeixinLog($uid, 'init_follow_check_uid');
     if ($uid) {
         return $uid;
     }
     // 自动注册
     $config = getAddonConfig('UserCenter', $token);
     $user = array('experience' => intval($config['experience']), 'score' => intval($config['score']), 'reg_ip' => get_client_ip(1), 'reg_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1), 'last_login_time' => NOW_TIME, 'status' => 1, 'is_init' => 1, 'is_audit' => 1, 'come_from' => 1);
     $user2 = getWeixinUserInfo($openid);
     $user = array_merge($user, $user2);
     $data['uid'] = $uid = D('Common/User')->add($user);
     if ($has_subscribe !== false) {
         $data['has_subscribe'] = $has_subscribe;
     }
     M('public_follow')->add($data);
     return $uid;
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:27,代码来源:FollowModel.class.php

示例7: testCheckIn

    public function testCheckIn()
    {
        $json = '{
  "watched_at": "2014-08-06T01:11:37.953Z",
  "sharing": {
    "facebook": true,
    "twitter": true,
    "tumblr": false
  },
  "movie": {
    "title": "Guardians of the Galaxy",
    "year": 2014,
    "ids": {
      "trakt": 28,
      "slug": "guardians-of-the-galaxy-2014",
      "imdb": "tt2015381",
      "tmdb": 118340
    }
  }
}';
        $client = Mockery::mock(stdClass::class . ", " . ClientInterface::class);
        $request = Mockery::mock(stdClass::class . ", " . RequestInterface::class);
        $response = Mockery::mock(stdClass::class . ", " . ResponseInterface::class);
        $client->shouldReceive("createRequest")->once()->andReturn($request);
        $response->shouldReceive("getStatusCode")->once()->andReturn(200);
        $response->shouldReceive("json")->once()->andReturn(json_decode($json));
        $client->shouldReceive("send")->once()->andReturn($response);
        $auth = mock_auth();
        $trakt = new Trakt($auth, $client);
        $checkIn = $trakt->checkIn;
        $this->assertInstanceOf("Wubs\\Trakt\\Api\\CheckIn", $checkIn);
        $response = $checkIn->create(get_token(), movie($client), "nooo way!", ['facebook' => false, 'twitter' => false, 'tumblr' => false], "1200", "blablabla", "1.1", $this->today->format("Y-m-d"));
        $this->assertInstanceOf("Wubs\\Trakt\\Response\\CheckIn", $response);
    }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:34,代码来源:ApiTest.php

示例8: switch_theme

function switch_theme()
{
    global $themes;
    if (isset($_COOKIE['adminer_theme'])) {
        $THEME = $_COOKIE['adminer_theme'];
    } else {
        $THEME = "default";
    }
    echo "<form style='' action='' method='post' id='themes-form'>\n<div id='themes'>";
    echo lang('Themes: ');
    echo "<select name='theme' onchange='this.form.submit();'>";
    echo "<option value='default'>Default</option>";
    foreach ($themes as $key => $value) {
        $selected = "";
        if ($key == $THEME) {
            $selected = " selected='selected' ";
        }
        echo "<option value='{$key}' {$selected}>{$value}</option>";
    }
    echo "</select>";
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "<input type='hidden' name='token' value='" . get_token() . "'>\n";
    // $token may be empty in auth.inc.php
    echo "</div>\n</form>\n";
}
开发者ID:sk335577,项目名称:wp-adminer-db-manager,代码行数:25,代码来源:lang.inc.php

示例9: _initialize

 function _initialize()
 {
     //模板初始化
     C('DEFAULT_THEME', session('DEFAULT_THEME'));
     $token = get_token();
     $param = array('lists', 'config', 'nulldeal');
     if (in_array(_ACTION, $param) && (empty($token) || $token == '-1')) {
         $url = U('Public/lists?from=2');
         redirect($url);
     }
     // 管理员需要对插件的管理权限进行判断
     if (is_login()) {
         $token_status = D('Common/AddonStatus')->getList(false);
         if ($token_status[_ADDONS] == -1) {
             $this->error('你没有权限管理和配置该插件');
         }
         return true;
     }
     C('EDITOR_UPLOAD.rootPath', './Uploads/Editor/' . $token . '/');
     if ($GLOBALS['is_wap']) {
         // 默认错误跳转对应的模板文件
         C('TMPL_ACTION_ERROR', 'Addons:dispatch_jump_mobile');
         // 默认成功跳转对应的模板文件
         C('TMPL_ACTION_SUCCESS', 'Addons:dispatch_jump_mobile');
     } else {
         $this->_nav();
     }
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:28,代码来源:AddonsController.class.php

示例10: show

 function show($widget)
 {
     $map['token'] = get_token();
     if ($widget['data_from'] == 2) {
         // 部分商品 cate_id=1,2,3&search_key=[search_key]&shopping_list=1
         $condition = str_replace(array('[cate_id]', '[search_key]'), array($_REQUEST['cate_id'], $_REQUEST['search_key']), $widget['data_condition']);
         parse_str($condition, $output);
         if (!empty($output['cate_id'])) {
             $map = getIdsForMap($output['cate_id'], $map, 'cate_id_1');
         }
         if (!empty($output['search_key'])) {
             $key = safe($output['search_key']);
             $map['title'] = array('like', "%{$key}%");
         }
         if (isset($output['shopping_list'])) {
             // 购物清单 TODO
         }
     } elseif ($widget['data_from'] == 1) {
         // 指定商品
         $map = getIdsForMap($widget['data_ids'], $map);
     }
     if (isset($_REQUEST['cate_id'])) {
         $cid = intval($_REQUEST['cate_id']);
         $map['_string'] = ' (cate_id_1=' . $cid . ' or cate_id_2=' . $cid . ') ';
     }
     $list = M('shop_product')->where($map)->order($widget['order'])->selectPage($widget['list_row']);
     // dump ( $list );
     $this->assign('list', $list);
     // dump ( $widget );
     return $this->getWidgetHtml($widget);
 }
开发者ID:devsnippet,项目名称:wechatTools,代码行数:31,代码来源:DealController.class.php

示例11: add_qr_code

 function add_qr_code($action_name = 'QR_SCENE', $addon = '', $aim_id = '', $extra_int = '', $extra_text = '')
 {
     set_time_limit(30);
     $data['scene_id'] = $this->get_scene_id($action_name);
     if (!$data['scene_id']) {
         return -1;
         // 场景值已满
     }
     $data['addon'] = $addon;
     $data['aim_id'] = $aim_id;
     $data['action_name'] = $action_name;
     $data['extra_text'] = $extra_text;
     $data['extra_int'] = $extra_int;
     $data['cTime'] = time();
     $data['token'] = get_token();
     $data['qr_code'] = $this->QrcodeCreate($data['scene_id'], $data['action_name']);
     // dump ( $data );
     // exit ();
     if (!$data['qr_code']) {
         return -2;
         // 获取二维码失败
     }
     $res = $this->add($data);
     if (!$res) {
         return -3;
         // 保存数据失败
     }
     return $data['qr_code'];
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:29,代码来源:QrCodeModel.class.php

示例12: cascade

 /**
  * 编辑器挂载的后台文档模型文章内容钩子
  *
  * type=db&table=common_category&module=shop_category&value_field=id
  * type=text&data=[广西[南宁,桂林], 广东[广州, 深圳[福田区, 龙岗区, 宝安区]]]
  */
 public function cascade($data)
 {
     $key = $data['name'] . '_' . get_token();
     $json = S($key);
     if ($json === false) {
         parse_str($data['extra'], $arr);
         empty($arr['type']) && ($arr['type'] = 'db');
         if ($arr['type'] == 'db') {
             $table = !empty($arr['table']) ? $arr['table'] : 'common_category';
             $value_field = !empty($arr['value_field']) ? $arr['value_field'] : 'id';
             $custom_field = !empty($arr['custom_field']) ? $arr['custom_field'] : 'id,title,pid,sort';
             $custom_pid = !empty($arr['custom_pid']) ? $arr['custom_pid'] : 0;
             unset($arr['type'], $arr['table'], $arr['value_field'], $arr['custom_field'], $arr['custom_pid']);
             // dump($arr);
             $arr['token'] = get_token();
             $list = M($table)->where($arr)->field($custom_field)->order('pid asc, sort asc')->select();
             // lastsql();
             // dump($list);
             $tree = $this->makeTree($list, $custom_pid, $value_field);
         } else {
             $tree = $this->str2json($arr['data']);
         }
         // dump ( $tree );
         $json = json_encode($tree);
         S($key, $json, 86400);
     }
     // dump ( $json );
     $this->assign('json', $json);
     $data['default_value'] = $data['value'];
     empty($data['default_value']) || ($data['default_value'] = '"' . str_replace(',', '","', $data['default_value']) . '"');
     $this->assign($data);
     $this->display('content');
 }
开发者ID:noikiy,项目名称:weiphp,代码行数:39,代码来源:CascadeAddon.class.php

示例13: getCommonArticles

 public function getCommonArticles($extra_int)
 {
     $map['token'] = get_token();
     $extra_int && ($map['id'] = $extra_int);
     $data = M('scratch')->where($map)->order('id desc')->select();
     if (!$data) {
         return true;
     }
     // 其中token和openid这两个参数一定要传,否则程序不知道是哪个微信用户进入了系统
     //$param ['token'] = get_token ();
     //$param ['openid'] = get_openid ();
     foreach ($data as $key => $vo) {
         $param['id'] = $vo['id'];
         $url = addons_url('Scratch://Scratch/show', $param);
         $articles[$key] = array('Title' => $vo['title'], 'Url' => $url);
         $now = time();
         if ($vo['end_time'] > $now) {
             $articles[$key]['Description'] = $vo['intro'];
             $articles[$key]['PicUrl'] = !empty($vo['cover']) ? get_cover_url($vo['cover']) : SITE_URL . '/Addons/Scratch/View/default/Public/cover_pic.jpg';
         } else {
             $articles[$key]['Description'] = $vo['end_tips'];
             $articles[$key]['PicUrl'] = !empty($vo['end_cover']) ? get_cover_url($vo['end_cover']) : SITE_URL . '/Addons/Scratch/View/default/Public/cover_pic_over.png';
         }
     }
     //foreach
     $this->replyNews($articles);
 }
开发者ID:strivi,项目名称:siples,代码行数:27,代码来源:WeixinAddonModel.class.php

示例14: move_group

 function move_group($id, $group_id)
 {
     is_array($id) || ($id = explode(',', $id));
     $data['uid'] = $map['uid'] = array('in', $id);
     // $data ['group_id'] = $group_id; //TODO 前端微信用户只能有一个微信组
     $res = M('auth_group_access')->where($data)->delete();
     $data['group_id'] = $group_id;
     foreach ($id as $uid) {
         $data['uid'] = $uid;
         $res = M('auth_group_access')->add($data);
         // 更新用户缓存
         D('Common/User')->getUserInfo($uid, true);
     }
     $group = $this->find($group_id);
     // 同步到微信端
     if (C('USER_GROUP') && !empty($group['wechat_group_id'])) {
         $url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=' . get_access_token();
         $map['token'] = get_token();
         $follow = M('public_follow')->where($map)->field('openid, uid')->select();
         foreach ($follow as $v) {
             if (empty($v['openid'])) {
                 continue;
             }
             $param['openid'] = $v['openid'];
             $param['to_groupid'] = $group['wechat_group_id'];
             $param = JSON($param);
             $res = post_data($url, $param);
         }
     }
     return $group;
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:31,代码来源:AuthGroupModel.class.php

示例15: ImageManager

 public function ImageManager()
 {
     $name = I("name");
     $id = I("id");
     $times = I("times", 0, "intval");
     $where = array();
     if (!empty($times)) {
         $where = $this->getTimeMap($times);
     }
     /*wzh2015年8月13日15:24:46增加token筛选,避免不同账号图片错乱*/
     $where['token'] = get_token();
     $strTimes = $this->getPictureTimes(array('token' => $where['token']));
     $PictureResult = $this->getAllPictureData($where);
     $config = $this->config;
     //var_dump($PictureResult);die;
     $this->assign("addon_path", "./Plugins/ImageManager/");
     $this->assign("curtime", $times);
     $this->assign("strTimes", $strTimes);
     $arrname = strpos($name, '[') == false ? $name : explode('[', trim($name, ']'));
     is_array($arrname) && ($name = $arrname[1]);
     $this->assign("name", $name);
     $this->assign("id", $id);
     $this->assign("config", $config);
     $this->assign($PictureResult);
     $this->display('index');
 }
开发者ID:ennnnny,项目名称:weiphp3,代码行数:26,代码来源:ImageManagerController.class.php


注:本文中的get_token函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。