本文整理汇总了PHP中JSSDK类的典型用法代码示例。如果您正苦于以下问题:PHP JSSDK类的具体用法?PHP JSSDK怎么用?PHP JSSDK使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSSDK类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_action
function show_action()
{
$this->rightinfo();
$this->get_moblie();
$UserinfoM = $this->MODEL('userinfo');
$CacheM = $this->MODEL('cache');
$CacheList = $CacheM->GetCache(array('job', 'com', 'city', 'hy'));
$this->yunset($CacheList);
$row = $UserinfoM->GetUserinfoOne(array('uid' => (int) $_GET['id']), array('usertype' => 2));
$row['lastupdate'] = date("Y-m-d", $row['lastupdate']);
$this->yunset("row", $row);
$data['company_name'] = $row['name'];
$data['company_name_desc'] = $row['content'];
$this->data = $data;
//这里是微信jssdk
$jssdk = new JSSDK();
$WxData = $jssdk->getSignPackage();
$this->yunset("wxAppid", $WxData['appId']);
$this->yunset('wxNonceStr', $WxData['nonceStr']);
$this->yunset('wxTimestamp', $WxData['timestamp']);
$this->yunset('wxSignature', $WxData['signature']);
//微信jssdk结束
$this->seo("company_index");
$this->yunset("headertitle", "公司详情");
$this->yuntpl(array('wap/company_show'));
}
示例2: media_get
static function media_get($media_id)
{
require_once PATH_LIBS . "/wechat/jssdk.php";
$jssdk = new JSSDK(Model_Setting::get("WX_APPID"), Model_Setting::get("WX_APPSECRET"));
$url = $jssdk->media_get($media_id);
return $url;
}
示例3: _initialize
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 {
}
}
示例4: 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();
}
示例5: show_action
function show_action()
{
$this->rightinfo();
$ResumeM = $this->MODEL('resume');
if ($_GET['uid']) {
if ($_GET['type'] == "2") {
$user = $ResumeM->GetResumeExpectOne(array("uid" => (int) $_GET['uid'], "height_status" => '2'));
$id = $user['id'];
} else {
$def_job = $ResumeM->SelectResumeOne(array("uid" => (int) $_GET['uid'], "`r_status`<>'2'"));
$id = $def_job['def_job'];
}
} else {
$id = (int) $_GET['id'];
}
$user = $ResumeM->resume_select($_GET['id']);
$ResumeM->AddExpectHits($id);
if ($_COOKIE['usertype'] == "2" || $_COOKIE['usertype'] == "3") {
$this->yunset("uid", $_COOKIE['uid']);
$ResumeM->RemindDeal("userid_job", array("is_browse" => "2"), array("com_id" => $this->uid, "eid" => (int) $_GET['id']));
if ($_COOKIE['usertype'] == "2") {
$this->unset_remind("userid_job", '2');
} else {
$this->unset_remind("userid_job3", '3');
}
$look_resume = $ResumeM->SelectLookResumeOne(array("com_id" => $this->uid, "resume_id" => $id));
if (!empty($look_resume)) {
$ResumeM->SaveLookResume(array("datetime" => time()), array("resume_id" => $id, "com_id" => $this->uid));
} else {
$data['uid'] = $user['uid'];
$data['resume_id'] = $id;
$data['com_id'] = $this->uid;
$data['datetime'] = time();
$ResumeM->SaveLookResume($data);
}
}
$data['resume_username'] = $user['username_n'];
$data['resume_city'] = $user['city_one'] . "," . $user['city_two'];
$data['resume_job'] = $user['hy'];
$this->data = $data;
//这里是微信jssdk
$jssdk = new JSSDK();
$WxData = $jssdk->getSignPackage();
$this->yunset("wxAppid", $WxData['appId']);
$this->yunset('wxNonceStr', $WxData['nonceStr']);
$this->yunset('wxTimestamp', $WxData['timestamp']);
$this->yunset('wxSignature', $WxData['signature']);
//微信jssdk结束
$this->seo("resume");
$this->yunset("Info", $user);
$this->yunset("headertitle", "找人才");
$this->yuntpl(array('mobile/resume_show'));
}
示例6: loginout_action
function loginout_action()
{
$this->unset_cookie();
//这里是微信jssdk
$jssdk = new JSSDK();
$WxData = $jssdk->getSignPackage();
$this->yunset("wxAppid", $WxData['appId']);
$this->yunset('wxNonceStr', $WxData['nonceStr']);
$this->yunset('wxTimestamp', $WxData['timestamp']);
$this->yunset('wxSignature', $WxData['signature']);
//微信jssdk结束
$this->wapheader('index.php');
}
示例7: index_action
function index_action()
{
$this->get_moblie();
//这里是微信jssdk
$jssdk = new JSSDK();
$WxData = $jssdk->getSignPackage();
$this->yunset("wxAppid", $WxData['appId']);
$this->yunset('wxNonceStr', $WxData['nonceStr']);
$this->yunset('wxTimestamp', $WxData['timestamp']);
$this->yunset('wxSignature', $WxData['signature']);
//微信jssdk结束
$this->yunset("title", "附近职位");
$this->yunset('JobList', $JobList);
$this->yuntpl(array('wap/map'));
}
示例8: index_action
function index_action()
{
$this->get_moblie();
$this->yunset("headertitle", "找回密码");
$this->seo("forgetpw");
//这里是微信jssdk
$jssdk = new JSSDK();
$WxData = $jssdk->getSignPackage();
$this->yunset("wxAppid", $WxData['appId']);
$this->yunset('wxNonceStr', $WxData['nonceStr']);
$this->yunset('wxTimestamp', $WxData['timestamp']);
$this->yunset('wxSignature', $WxData['signature']);
//微信jssdk结束
$this->yuntpl(array('wap/forgetpw'));
}
示例9: result
public function result(Requests\YikangQustionnaireRequest $request)
{
$jssdk = new JSSDK(env('WX_APPID'), env('WX_SECRET'));
$signPackage = $jssdk->getSignPackage();
$request->persist();
/** @var Customer $customer */
$customer = \Helper::getCustomerOrFail();
$q = $customer->yikangQuestionnaire()->first();
if ($q->q1 == '口服药等其他治疗方式' || $q->q2 == '已停用') {
$result = 1;
} else {
$result = 2;
}
return view('questionnaire.finish2')->with(['result' => $result, 'signPackage' => $signPackage]);
}
示例10: _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);
}
示例11: _initialize
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");
}
}
示例12: _initialize
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 {
}
}
示例13: header
$url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3363e46c74608f3&redirect_uri=http%3a%2f%2fwx.tyll.net.cn%2fDingdingCat%2findex.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
header("Location:" . $url);
}
$get_token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $secret . '&code=' . $code . '&grant_type=authorization_code';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $get_token_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$res = curl_exec($ch);
curl_close($ch);
$json_obj = json_decode($res, true);
//根据openid和access_token查询用户信息
$access_token = $json_obj['access_token'];
$openid = $json_obj['openid'];
$jsapi = new JSSDK("wxa3363e46c74608f3", "52be407940dece37327465c1d211cfb4");
$signPackage = $jsapi->getSignPackage();
?>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>叮叮猫</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" href="style/style.css?v=1"/>
<link rel="stylesheet" href="js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.css"/>
<script>
var openid = "<?php
示例14: httpGet
} else {
$access_token = $data->access_token;
}
return $access_token;
}
private function httpGet($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}
}
session_start();
// if(!isset($_REQUEST['url'])) {
// echo "invalid arguments";
// exit;
// }
$appID = "微信公众号";
$appSecret = "秘钥";
$url = $_REQUEST['url'];
$url = base64_decode($url);
$jssdk = new JSSDK($appID, $appSecret);
$signPackage = $jssdk->getSignPackage($url);
$signPackage['jsApiList'] = array('checkJsApi', 'chooseImage', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'previewImage', 'uploadImage', 'downloadImage', 'getNetworkType');
echo json_encode($signPackage);
示例15: downloadWeiXinFile
function downloadWeiXinFile($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURL_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURL_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$package = curl_exec($ch);
$httpinfo = curl_getinfo($ch);
curl_close($ch);
$imageAll = array_merge(array('header' => $httpinfo), array('body' => $package));
return $imageAll;
}
function saveWeixinFile($filename, $filecontent)
{
$local_file = fopen($filename, 'w');
if (false !== $local_file) {
if (false !== fwrite($local_file, $filecontent)) {
fclose($local_file);
}
}
}
}
$jsonData = '{
"card_id": "pSz8NuBa1Ic5Rn7wtphdga4Zzt20"
}';
$jssdk = new JSSDK('wxfcea725d621989f7', 'c732e508229ddb6568e2216fa7c62fa2');
//$a = $jssdk->wxBatchQueryCardList();
$a = $jssdk->wxCardGetInfo($jsonData);
var_dump($a);