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


PHP Wechat::getQRCode方法代码示例

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


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

示例1: 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

示例2: logdebug

<?php

/**
 * 微信公共接口测试
 *
 */
include "../wechat.class.php";
function logdebug($text)
{
    file_put_contents('../data/log.txt', $text . "\n", FILE_APPEND);
}
$options = array('token' => 'tokenaccesskey', 'debug' => true, 'logcallback' => 'logdebug');
$weObj = new Wechat($options);
// check null $scene_id
$qrcode = $weObj->getQRCode();
if ($qrcode != false) {
    echo "test failed.\n";
    die;
}
// check bad $type
$qrcode = $weObj->getQRCode(123, -1);
if ($qrcode != false) {
    echo "test failed.\n";
    die;
}
// check bad $type
$qrcode = $weObj->getQRCode(123, 5);
if ($qrcode != false) {
    echo "test failed.\n";
    die;
}
开发者ID:sadiqhirani,项目名称:wechat-php-sdk,代码行数:31,代码来源:getQRCode_test.php

示例3: http_get

    $error1 = array("status" => "101", "des" => "缺少@get参数Numbe stationId");
    echo json_encode($error1);
    exit;
}
if (isset($_GET['expire'])) {
    $expire = $_GET['expire'];
} else {
    $expire = 60;
}
$getStationUrl = $apiUrl . "/getStation.php?stationId=" . $stationId;
$getStation = json_decode(http_get($getStationUrl));
if ($getStation->status == 0) {
    $w = new Wechat($options);
    for ($i = 0; $i < 5; $i++) {
        $j = $i + 1;
        $ticket[$i] = $w->getQRCode($stationId, 0, $expire * $j);
        $qrcodeUrl[$i] = $w->getQRUrl($ticket[$i]['ticket']);
        $stationInfo[$i] = array('stationId' => $stationId, 'name' => $getStation->info->name, 'number' => $getStation->info->number, 'qrcodeUrl' => $qrcodeUrl[$i], 'expire_seconds' => $ticket[$i]['expire_seconds']);
    }
    $result = array('status' => 0, 'info' => $stationInfo);
    echo json_encode($result);
} else {
    echo json_encode($getStation);
    exit;
}
/**
 * GET 请求
 * @param string $url
 */
function http_get($url)
{
开发者ID:MiaoMiaosha,项目名称:bike,代码行数:31,代码来源:getQrcode.php

示例4: Browscap

}
if ($res['ticket'] != 'authorized') {
    $bc = new Browscap();
    $client_type = $bc->get_type();
    if (!$fromUserName && $client_type != Browscap::MOBILE) {
        include_once WEIXIN_PATH . '/class/wechat.class.php';
        $options = array('token' => WECHAT_TOKEN, 'appid' => WECHAT_APP_ID, 'appsecret' => WECHAT_APP_SECRET);
        $weObj = new Wechat($options);
        $sql = "select `Mac_ID`, `scene_id`, `created_at`,\n                       `updated_at`, `ticket`\n                from " . WEIXIN_TABLE . "\n                where `Mac_ID` = '{$Mac_ID}'\n                and `ticket` != 'authorized'\n                limit 1";
        $result = $mysql::query($sql, 'all');
        $expire = 500;
        if (!is_array($result) || count($result) < 0) {
            $sql = "select `scene_id` from " . WEIXIN_TABLE . " order by id desc limit 1";
            $scene_id = $mysql::query($sql, '1');
            $scene_id = $scene_id % 9999 + 1;
            $qrcode = $weObj->getQRCode($scene_id, $type = 0, $expire);
            $ticket = $qrcode['ticket'];
            $sql = "insert into " . WEIXIN_TABLE . " (`Mac_ID`, `ticket`, `scene_id`,  `site`)\n                    values ('{$Mac_ID}', '{$ticket}', '{$scene_id}', '{$site}')";
        } else {
            $created_at = $result[0]['created_at'];
            $updated_at = $result[0]['updated_at'];
            $now = time();
            if ($now - strtotime($created_at) > $expire && $now - strtotime($updated_at) > $expire) {
                $qrcode = $weObj->getQRCode($result[0]['scene_id'], $type = 0, $expire);
                $ticket = $qrcode['ticket'];
                $updated_at = date("Y-m-d H:i:s");
                $sql = "update " . WEIXIN_TABLE . " set `ticket` = '{$ticket}', `updated_at` = '{$updated_at}' where `Mac_ID` = '{$Mac_ID}'";
            } else {
                $ticket = $result[0]['ticket'];
            }
        }
开发者ID:blackzw,项目名称:auth,代码行数:31,代码来源:index.php

示例5: 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(intval($_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,代码来源:getQR.php


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