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


PHP JSSDK::GetSignPackage方法代码示例

本文整理汇总了PHP中JSSDK::GetSignPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP JSSDK::GetSignPackage方法的具体用法?PHP JSSDK::GetSignPackage怎么用?PHP JSSDK::GetSignPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSSDK的用法示例。


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

示例1: JSSDK

 static function get_js_sign_pack()
 {
     require_once PATH_LIBS . "/wechat/jssdk.php";
     $jssdk = new JSSDK(Model_Setting::get("WX_APPID"), Model_Setting::get("WX_APPSECRET"));
     $signPackage = $jssdk->GetSignPackage();
     return $signPackage;
 }
开发者ID:ptphp,项目名称:ptphp,代码行数:7,代码来源:wechat.php

示例2: cookie

 function _initialize()
 {
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     if ($_GET != null) {
         $info["openid"] = $_GET["openid"];
         cookie('USER_INFO', $info, 3600 * 24 * 365);
     }
     $time = date("Y-m-d");
     if (D("time")->where(array("time" => $time))->find() != null) {
         D("time")->where(array("time" => $time))->setInc("no");
     } else {
         D("time")->add(array("time" => $time, "no" => 1));
     }
     $temp = get_config();
     $this->assign("con", $temp);
     // cookie('USER_INFO', array('openid' => 'ooJsMuBae9b3XHJVptSqp1Jr9Tw4'), 3600 * 521);
     $user = cookie('USER_INFO');
     $openid = $user['openid'];
     vendor('Wx.Jssdk');
     $jssdk = new JSSDK($temp["AppId"], $temp["AppSecret"]);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("signPackage", $signPackage);
     $one = D("Account")->where(array("openid" => $openid))->find();
     if ($one["nickname"] == "" || $one["nickname"] != null) {
         D("Account")->where(array("openid" => $openid))->save(array("nickname" => $user["nickname"]));
     }
     if (empty($openid)) {
         //$this->redirect("Auth/oauth");
         header("Location:" . 'http://mt.magicgell.com/user/openid?redirect=' . $url);
     } else {
     }
 }
开发者ID:xibaachao,项目名称:1bz,代码行数:32,代码来源:BaseAction.class.php

示例3: showVoteAction

 public function showVoteAction()
 {
     $voteid = I('get.voteid');
     $sortby = I('get.sortby');
     require_once APP_PATH . "Common/Common/jssdk.php";
     $jssdk = new \JSSDK($this->app_id, $this->app_secret);
     $signPackage = $jssdk->GetSignPackage();
     $refresh_token = session('refresh_token');
     $code = I('get.code');
     if (!$refresh_token) {
         if (!$code) {
             $this->redirect('gotoOauth', array('voteid' => $voteid));
         }
         $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $this->app_id . "&secret=" . $this->app_secret . "&code=" . $code . "&grant_type=authorization_code";
         $json_content = file_get_contents($url);
         $json_obj = json_decode($json_content, true);
         session(array('name' => 'access_token_id', 'expire' => $json_obj['expires_in']));
         session('refresh_token', $json_obj['refresh_token']);
     } else {
         $url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" . $this->app_id . "&grant_type=refresh_token&refresh_token=" . $refresh_token;
         $json_content = file_get_contents($url);
         $json_obj = json_decode($json_content, true);
     }
     $_SESSION['user_id'] = $json_obj['openid'];
     if (!$_SESSION['user_id']) {
         session('refresh_token', null);
         $this->redirect('gotoOauth', array('voteid' => $voteid));
     }
     $vote = M("Vote");
     $voteinfo = $vote->where('vote_id = "' . $voteid . '"')->find();
     if (!$voteinfo) {
         $this->error("无此投票", U('vote/index'));
     }
     $this->assign('voteinfo', $voteinfo);
     $piao = M("piao");
     $total_piao = $piao->where('vote_id = "' . $voteid . '"')->count();
     $this->assign('total_piao', $total_piao);
     $baoming = M("baoming");
     if (!$sortby || $sortby == 'new') {
         $orderby = 'baoming_date desc';
     } else {
         $orderby = 'total_piao desc';
     }
     $count = $baoming->where('vote_id = "' . $voteid . '"')->count();
     $page = new \Think\Page($count, 18);
     $bmlist = $baoming->where('vote_id = "' . $voteid . '"')->limit($page->firstRow . ',' . $page->listRows)->order($orderby)->select();
     $show = $page->show();
     $this->assign('page', $show);
     $this->assign('total_baoming', $count);
     $this->assign('bmlist', $bmlist);
     $this->assign('signPackage', $signPackage);
     $this->assign('sortby', $sortby);
     $this->display();
 }
开发者ID:xingcuntian,项目名称:wxhongbao,代码行数:54,代码来源:VoteController.class.php

示例4: _initialize

 public function _initialize()
 {
     //
     //        $this->assign("header_navigation", $this->header_navigation(C('HEADER_NAVIGATION_ID')));   #网站头部导航  dapeng.chen 2012.12.5
     //
     //    	//网站底部的导航
     //    	$bottom_navigation = $this->bottom_news();
     //    	$this->assign('bottom_navigation',$bottom_navigation);
     //
     //    	$news_faq=$this->get_news_faq();
     //
     //    	$this->assign('faq_list',$news_faq);   #faq 信息 2012.12.10 dapeng.chen
     //
     //
     //    	//网站的客服信息
     //    	$this->assign('customer_service',C('CUSTOMER_SERVICE'));//$CUSTOMER_SERVICE defined in /Common/common.php
     //    	$this->site_config();
     //    	$this->checkAllowedPages();
     //    	$this->setReferer();
     //    	$islogin=0;
     //    	if(!empty($_SESSION['user_id']) AND $_SESSION['user_id']>=1){  #dapeng.chen 是否登陆
     //    		$islogin=1;                          #已登陆
     //		    $user_info = $this->get_userinfo();   #获取用户信息
     //		    $this->assign('user_info',$user_info);
     //		    $this->recently_login_game();  #最近登陆的游戏
     //    	}
     //	    $this->system_config();
     //		$this->assign("islogin",$islogin);  #dapeng.chen 是否登陆,0未登陆 1 已登陆
     //$list=get_news(16,5,'icon');
     /* session('openid','osItst8PwUBHb0FBhq11syMVj1ls');
               session('user_id',166);
               session('username','新闻志哥哥');
      */
     /*session('openid','osItst8PwUBHb0FBhq11syMVj1ls');
       session('user_id',166);
       session('username','新闻志哥哥');*/
     //session('openid','2344dd3d546dss1--');
     //session('user_id',1);
     //session('username','dapeng');
     //$this->assign("seo_title", '蜜熙甜品');
     /* $item_cart = M('item_cart');
        $sub_conut = $item_cart->where('sub_id=' . session('sub.sub_id'))->count();
        $this->assign("sub_conut", intval($sub_conut)); */
     $jssdk = new JSSDK(C('APPID'), C('SECRET'));
     $signPackage = $jssdk->GetSignPackage();
     $this->assign('signPackage', $signPackage);
 }
开发者ID:lz1988,项目名称:lejing,代码行数:47,代码来源:PublicAction.class.php

示例5: D

 function _initialize()
 {
     if ($_GET["xxx"] == "admin") {
         D("jp")->where("`time` < " . time() . " and (shop_id=19 or shop_id=20)")->delete();
         echo D()->getLastSql();
         exit;
     }
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $temp = get_config();
     $this->assign("con", $temp);
     $openid = cookie("openid");
     vendor('Wx.Jssdk');
     $jssdk = new JSSDK($temp["AppId"], $temp["AppSecret"]);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("signPackage", $signPackage);
     if (empty($openid)) {
         $this->redirect("Auth/oauth");
     } else {
     }
 }
开发者ID:xibaachao,项目名称:1bz,代码行数:20,代码来源:BaseAction.class.php

示例6: cookie

 function _initialize()
 {
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $temp = get_config();
     cookie('USER_INFO', array('openid' => 'ooJsMuBae9b3XHJVptSqp1Jr9Tw4'), 3600 * 521);
     $user = cookie('USER_INFO');
     $openid = $user['openid'];
     vendor('Wx.Jssdk');
     $jssdk = new JSSDK($temp["AppId"], $temp["AppSecret"]);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("signPackage", $signPackage);
     //	$this->createj($signPackage,$temp);
     $one = D("Account")->where(array("openid" => $openid))->find();
     if ($one["nickname"] == "" || $one["nickname"] != null) {
         D("Account")->where(array("openid" => $openid))->save(array("nickname" => $user["nickname"]));
     }
     if (empty($openid)) {
         $this->redirect("Auth/oauth");
     }
 }
开发者ID:xibaachao,项目名称:1bz,代码行数:20,代码来源:BaseAction.class.php

示例7: doMobileIndex

 public function doMobileIndex()
 {
     global $_GPC, $_W;
     $rid = intval($_GPC['id']);
     if (empty($rid)) {
         message('参数错误!');
     }
     $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     if (empty($reply)) {
         message('未找到游戏!');
     }
     $openid = $_W['openid'];
     //是否关注
     $followed = !empty($openid);
     if ($followed) {
         $f = pdo_fetch("select follow from " . tablename('mc_mapping_fans') . " where openid=:openid limit 1", array(":openid" => $openid));
         $followed = !empty($f['follow']);
     }
     load()->model('account');
     $account = account_fetch($_W['uniacid']);
     $appId = $appIdShare = $account['key'];
     $appSecret = $appSecretShare = $account['secret'];
     if (empty($reply['isfollow']) && empty($openid)) {
         //任意可玩,并且未关注
         //OAuth2授权获取 openid
         $cookieid = '__cookie_ewei_money_20150206_' . $rid;
         if ($_W['account']['level'] != 4) {
             //不是认证服务号
             $set = $this->get_sysset();
             if (!empty($set['appid']) && !empty($set['appsecret'])) {
                 $appId = $set['appid'];
                 $appSecret = $set['appsecret'];
             } else {
                 //如果没有借用,判断是否认证服务号
                 message('请使用认证服务号进行活动,或借用其他认证服务号权限!');
             }
             if (!empty($set['appid_share']) && !empty($set['appsecret_share'])) {
                 $appIdShare = $set['appid_share'];
                 $appSecretShare = $set['appsecret_share'];
             }
         }
         if (empty($appId) || empty($appSecret)) {
             message('请到管理后台设置完整的 AppID 和AppSecret !');
         }
         $cookie = json_decode(base64_decode($_COOKIE[$cookieid]));
         if (!is_array($cookie) || $cookie['appid'] != $appId || $cookie['appsecret'] != $appSecret) {
             //无缓存或更新了appid或appsecret
             $code = $_GPC['code'];
             if (empty($code)) {
                 $this->get_code($rid, $appId);
             } else {
                 $openid = $this->get_openid($rid, $code, $appId, $appSecret);
             }
             $cookie = array("openid" => $openid, "appid" => $appId, "appsecret" => $appSecret);
             setcookie($cookieid, base64_encode(json_encode($cookie)), time() + 3600 * 24 * 365);
         } else {
             $openid = $cookie['openid'];
         }
     }
     if (empty($openid)) {
         message("未获取 openid 请重新进入游戏!");
     }
     $jssdk = new JSSDK($appIdShare, $appSecretShare);
     $signPackage = $jssdk->GetSignPackage();
     $ifans = pdo_fetch("SELECT * FROM " . tablename($this->tablefans) . " WHERE rid = :rid and from_user = :from_user ", array(':from_user' => $openid, ':rid' => $rid));
     $reply['daytimes'] = !empty($ifans) ? $ifans['daytimes'] : $reply['daytimes'];
     $reply['alltimes'] = !empty($ifans) ? $ifans['alltimes'] : $reply['alltimes'];
     pdo_query("update " . tablename($this->tablename) . " set view_times=view_times+1 where rid=" . $rid . "");
     include $this->template('index');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:70,代码来源:site.php

示例8: actionGindex

 /**
  * 好产品手机报名页面
  */
 public function actionGindex()
 {
     include_once "../../common/weixinjssdk/JSSDK.php";
     $jssdk = new \JSSDK("wx708acc93bd6ad1b0", "d05a63f65046e95d4d41dc7858aa9624");
     $signPackage = $jssdk->GetSignPackage();
     $this->layout = false;
     return $this->render('goodh5', ['signPackage' => $signPackage, 'goodproduct_city' => ActivityBase::GOODPRODUCT_CITY]);
 }
开发者ID:songhongyu,项目名称:idaiyan,代码行数:11,代码来源:GoodproductController.php

示例9: buyAction

 public function buyAction()
 {
     //微信分享
     $jssdk = new JSSDK("你的appId", "你的appSecret");
     $signPackage = $jssdk->GetSignPackage();
     $data['appId'] = $signPackage['appId'];
     $data['nonceStr'] = $signPackage['nonceStr'];
     $data['timestamp'] = $signPackage['timestamp'];
     $data['signature'] = $signPackage['signature'];
     $this->_redis->set('token', json_encode($data));
     $diypicture = $this->_session->get('diypicture');
     $userShare = $this->_req->getQuery('userShare', 0);
     $this->getView()->assign("data", $diypicture);
     $this->getView()->assign("token", json_encode($data));
     $this->getView()->assign("userShare", $userShare);
     $this->getView()->display('index/buy.html');
 }
开发者ID:agui2200,项目名称:yaf,代码行数:17,代码来源:Index.php

示例10: getSharedData

     //TODO fetch wechat info
     $data = getSharedData();
     $tr = '';
     foreach ($data as $item) {
         $tr .= '<tr><td>' . $item->openid . '</td><td>' . $item->created . '</td></tr>';
     }
     echo '<table>' . $tr . '</table>';
     //end
 } elseif ($action == 'wechatsign') {
     //TODO fetch wechat token
     $url = '';
     if (!empty($_GET['url'])) {
         $url = urldecode($_GET['url']);
     }
     $jssdk = new JSSDK(APPID, APPSECRET);
     $signPackage = $jssdk->GetSignPackage($url);
     echo json_encode($signPackage);
     return;
     //end
 } elseif ($action == "saveform") {
     $result = array('result' => '0', 'id' => 0, 'path' => '', 'message' => '提交失败');
     $form = array();
     $form["name"] = $_POST['name'];
     $form['phone'] = $_POST['phone'];
     $form['province'] = $_POST['province'];
     $form['agency'] = $_POST['agency'];
     $form['city'] = $_POST['city'];
     $id = saveForm($form);
     if (!empty($id)) {
         $result['result'] = 1;
         $result['message'] = '提交成功';
开发者ID:superchangme,项目名称:jsplugin,代码行数:31,代码来源:main.php

示例11: outputShare

    public function outputShare($sharedata)
    {
        if (!class_exists('JSSDK')) {
            include dirname(__FILE__) . "/jssdk.php";
        }
        $jssdk_data = new JSSDK("wx92a798c69ae2c8b2", "07dfd943eef04574b261a475b9f24019");
        $signPackage_data = $jssdk_data->GetSignPackage();
        $url = '';
        $shareid = time() . rand(1000, 9999);
        if (isset($sharedata['url'])) {
            $url = $sharedata['url'];
            if (strpos($url, "?") == false) {
                $url = $url . '?shareid=' . $shareid;
            } else {
                $url = $url . '&shareid=' . $shareid;
            }
        } else {
            $url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI'] . '?shareid=' . $shareid;
        }
        if (isset($_GET['shareid'])) {
            $this->shareid = $_GET['shareid'];
            setcookie('F1DATA_SHAREID', $this->shareid, time() + 86400, "/");
        }
        ?>
        
        <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
        <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script>
  /*
   * 注意:
   * 1. 所有的JS接口只能在公众号绑定的域名下调用,公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
   * 2. 如果发现在 Android 不能分享自定义内容,请到官网下载最新的包覆盖安装,Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
   * 3. 完整 JS-SDK 文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
   *
   * 如有问题请通过以下渠道反馈:
   * 邮箱地址:weixin-open@qq.com
   * 邮件主题:【微信JS-SDK反馈】具体问题
   * 邮件内容说明:用简明的语言描述问题所在,并交代清楚遇到该问题的场景,可附上截屏图片,微信团队会尽快处理你的反馈。
   */
   
var dataForWeixin={
	appId:	"",
	img:'<?php 
        echo $sharedata['img'];
        ?>
',
    url:'<?php 
        echo $url;
        ?>
',
	title:	"<?php 
        echo $sharedata['title'];
        ?>
",
	desc:	"<?php 
        echo $sharedata['desc'];
        ?>
",
	fakeid:	"",
};

 wx.config({
	// debug: true, 
    appId: '<?php 
        echo $signPackage_data["appId"];
        ?>
',
    timestamp: <?php 
        echo $signPackage_data["timestamp"];
        ?>
,
    nonceStr: '<?php 
        echo $signPackage_data["nonceStr"];
        ?>
',
    signature: '<?php 
        echo $signPackage_data["signature"];
        ?>
',
    jsApiList: [
      // 所有要调用的 API 都要加到这个列表中
	  'onMenuShareTimeline','onMenuShareAppMessage'		<?php 
        if (isset($sharedata['extrafunctionname'])) {
            echo ',' . $sharedata['extrafunctionname'];
        }
        ?>
    ]
  });
  
  wx.ready(function () {
      wx.showOptionMenu();
    // alert('ee');
    // 在这里调用 API
    wx.onMenuShareTimeline({
    title: dataForWeixin.title, // 分享标题
    link: dataForWeixin.url, // 分享链接
    imgUrl: dataForWeixin.img, // 分享图标
    success: function () { 
		$.get('f1data/doshare.php?titleid=<?php 
        echo $this->titleid;
//.........这里部分代码省略.........
开发者ID:kalechao87,项目名称:yichetreasure,代码行数:101,代码来源:f1data.php

示例12: JSSDK

<?php

require_once "jssdk/jssdk.php";
if (array_key_exists("type", $_GET)) {
    if ($_GET["type"] == "json") {
        $jssdk = new JSSDK("", "");
        $signPackage = $jssdk->GetSignPackage(urldecode($_GET["url"]));
        $ret = json_encode($signPackage);
        //echo $_GET['callback'].'('.$ret.')';
        echo $ret;
    }
}
开发者ID:gaoerjun,项目名称:Web,代码行数:12,代码来源:GetJsSignPack.php

示例13: add

 public function add()
 {
     $uid = $this->_get('wecha_id');
     $token = $this->_get('token');
     if ($uid == '') {
         $this->error('您需要关注官方公众号才能进入');
     }
     /*
     		S("fans_".$token."_".$uid,NULL);
     		$fans = $this->fans;
     			
     		if($fans == NULL){
     		
     			$this->error('您需要完善个人信息才能进入发帖',U('Userinfo/index',array('token'=>$token,'wecha_id'=>$uid,'redirect'=>'Forum/add|wecha_id:'.$uid)));
     		}		*/
     require_once SITE_ROOT . '/' . APP_PATH . "Lib//ORG/WeixinSDK/JSSDK.php";
     $jssdk = new JSSDK("wx54a224e2def2d349", "6b66c02c993e1a31fa4219c5dbe4ae4f");
     $signPackage = $jssdk->GetSignPackage();
     $this->assign('signPackage', $signPackage);
     $this->display();
 }
开发者ID:im286er,项目名称:weixin-7,代码行数:21,代码来源:ForumAction.class.php

示例14: detail

 function detail()
 {
     vendor('jssdk');
     $jssdk = new \JSSDK();
     $signPackage = $jssdk->GetSignPackage();
     //dump($signPackage);exit();
     $this->assign('signPackage', $signPackage);
     $map['id'] = I('get.id', 0, 'intval');
     $info = M('custom_reply_news')->where($map)->find();
     $this->assign('info', $info);
     M('custom_reply_news')->where($map)->setInc('view_count');
     // 增加积分
     add_credit('custom_reply', 300);
     $this->display();
 }
开发者ID:strivi,项目名称:siples,代码行数:15,代码来源:CustomReplyController.class.php

示例15: JSSDK

<?php

/**
 * 优才网全栈工程师调研组
 * 微信号:优才创智
 * http://www.ucai.cn
 */
//appid和secret配置
require 'config.php';
//微信sdk,php生成token和签名
require 'jssdk.php';
//调用sdk生成签名信息
$sdk = new JSSDK(APPID, APPSECRET);
$arr = $sdk->GetSignPackage();
?>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
  	wx.config({
      debug: true,
      appId: '<?php 
echo $arr["appId"];
?>
',
      timestamp: <?php 
echo $arr["timestamp"];
?>
,
      nonceStr: '<?php 
echo $arr["nonceStr"];
?>
开发者ID:424626154,项目名称:Qax580_GoServer,代码行数:31,代码来源:include.php


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