當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wechat::checkAuth方法代碼示例

本文整理匯總了PHP中Wechat::checkAuth方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::checkAuth方法的具體用法?PHP Wechat::checkAuth怎麽用?PHP Wechat::checkAuth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wechat的用法示例。


在下文中一共展示了Wechat::checkAuth方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: showTip

function showTip($smarty, $tip, $db, $title)
{
    $options = array('token' => WX_TOKEN, 'appid' => WX_APPID, 'encodingaeskey' => '6pnP7qHyqJ1kFXMjuO4Z3QrpOa9WfapsgkPOtXoZKC2', 'appsecret' => WX_SECRET, 'logcallback' => logdebug);
    $we = new Wechat($options);
    $auth = $we->checkAuth();
    $js_ticket = $we->getJsTicket();
    $smarty->assign('tip', $tip);
    $smarty->assign('title', $title);
    $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $smarty->assign('js_sign', $we->getJsSign($url));
    $smarty->display('templates/tip.html');
    $db->disconnect();
    die;
}
開發者ID:xuhongxu96,項目名稱:Tagexing,代碼行數:14,代碼來源:main.php

示例2: array

<?php

require_once '../config.php';
require_once '../db.php';
require_once '../wechat.class.php';
$options = array('token' => WX_TOKEN, 'appid' => WX_APPID, 'appsecret' => WX_SECRET, 'debug' => false, 'logcallback' => 'logdebug');
$weObj = new Wechat($options);
$weObj->checkAuth();
$ret = $weObj->getQRCode($_GET['id'], 1);
$url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . urlencode($ret['ticket']);
echo "<img src='{$url}' /><a href='{$url}'>View in new page</a>";
開發者ID:xuhongxu96,項目名稱:Tagexing,代碼行數:11,代碼來源:getprize.php

示例3: Wechat

<?php

// WP_Wechat Handle
$wechat = new WP_Wechat();
// wechat-php-sdk Handle
$we = new Wechat(array('appsecret' => $wechat->app_secret, 'appid' => $wechat->app_id));
$auth = $we->checkAuth();
$js_ticket = $we->getJsTicket();
if (!$js_ticket) {
    $errcode = $we->errCode;
    $errtext = ErrCode::getErrText($weObj->errCode);
    echo "獲取 js_ticket 失敗! 錯誤碼:{$errcode} 錯誤原因:{$errtext} ";
}
$https = isset($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS'];
$url = ($https ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$js_sign = $we->getJsSign($url);
?>

<script>
    if(window.wx) {
        wx.config({
            debug: /debug=1/.test(location.href),
            appId: '<?php 
echo $js_sign['appId'];
?>
', // 必填,公眾號的唯一標識
            timestamp: <?php 
echo $js_sign['timestamp'];
?>
, // 必填,生成簽名的時間戳,切記時間戳是整數型,別加引號
            nonceStr: '<?php 
開發者ID:EaseCloud,項目名稱:WP-Wechat,代碼行數:31,代碼來源:header-jssdk.php

示例4: check_auth

 /**
  * 獲取access_token的接口
  * @return [type] [description]
  */
 public function check_auth()
 {
     $appid = I('get.appid');
     $appsecret = I('get.appsecret');
     if (empty($appid) || empty($appsecret)) {
         echo json_encode(array('errmsg' => '信息不完整,請提供完整信息', 'errcode' => 1));
         exit;
     }
     $config = $this->model->table('wechat')->field('token, appid, appsecret')->where('appid = "' . $appid . '" and appsecret = "' . $appsecret . '" and status = 1')->find();
     if (empty($config)) {
         echo json_encode(array('errmsg' => '信息錯誤,請檢查提供的信息', 'errcode' => 1));
         exit;
     }
     $obj = new Wechat($config);
     $access_token = $obj->checkAuth();
     if ($access_token) {
         echo json_encode(array('access_token' => $access_token, 'errcode' => 0));
         exit;
     } else {
         echo json_encode(array('errmsg' => $obj->errmsg, 'errcode' => $obj->errcode));
         exit;
     }
 }
開發者ID:noikiy,項目名稱:shop-3,代碼行數:27,代碼來源:WechatController.class.php

示例5: DB

<?php

require_once '../config.php';
require_once '../function.php';
require_once '../db.php';
require_once '../wechat.class.php';
if ($_GET['p'][4] != ':') {
    $db = new DB();
    $db->connect();
    $weObj = new Wechat();
    $weObj->checkAuth(WX_APPID, WX_SECRET);
    echo "<img src='" . $weObj->getMediaURL($_GET['p']) . "'>";
    $db->disconnect();
} else {
    echo "<a href='" . $_GET['p'] . "'>" . $_GET['p'] . "</a><br>請複製鏈接查看原圖,或打開鏈接後在地址欄回車重新打開。(刷新無用)";
}
開發者ID:xuhongxu96,項目名稱:Tagexing,代碼行數:16,代碼來源:viewpic.php

示例6: array

<?php

/**
 * Created by PhpStorm.
 * User: run
 * Date: 2015/7/15
 * Time: 11:36
 */
include "wechat.class.php";
$options = array('token' => 'vonvon', 'encodingaeskey' => 'encodingaeskey', 'appid' => 'wx519f23f4a45e8c37', 'appsecret' => 'ea8f0b17b3a0882bf5fda7ed27758482');
$weObj = new Wechat($options);
$weObj->valid();
//明文或兼容模式可以在接口驗證通過後注釋此句,但加密模式一定不能注釋,否則會驗證失敗
$openid = $weObj->getRev()->getRevFrom();
$token = $weObj->checkAuth();
$info = $weObj->getUserInfo($openid);
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $content = $weObj->getRev()->getRevContent();
        if (substr($content, 0, 6) == '姓名') {
            $name = substr($content, 6);
            $res = array("0" => array('Title' => $name . ', 你的生辰八字', 'Description' => 'Vonvon作為國際化的SNS社交媒體,從2015年1月起,在全世界已經擁有1億以上的 用戶。現在已在韓國,中國,台灣,泰國,越南,印尼,美國,巴西,西班牙等國家 開放。將來會拓展到更多的國家,並且會創作更多有趣的主題測試。', 'PicUrl' => 'http://cdn-cn-static-dr.vonvon.net/images/cn/recruit_main.jpg', 'Url' => 'http://cn.vonvon.net/'));
            $weObj->news($res)->reply();
        } else {
            $weObj->text("Your nickname is " . $info['nickname'] . "\nYour sex is " . $info['sex'] . "\nYour city is " . $info['city'] . "\nYour province is " . $info['province'] . "\n Your country is " . $info['country'] . "\nYour headimgurl is " . $info['headimgurl'] . "\nYour subscribe_time is " . date("Y-m-d H:i:s", $info['subscribe_time']) . "\nNow is " . date("Y-m-d H:i:s", time()))->reply();
            exit;
        }
        break;
    case Wechat::MSGTYPE_EVENT:
        $event = $weObj->getRev()->getRevEvent();
開發者ID:shengnwen,項目名稱:vonvonWX,代碼行數:31,代碼來源:index.php


注:本文中的Wechat::checkAuth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。