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


PHP Wechat::getQRUrl方法代碼示例

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


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

示例1: values

     $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'];
     }
 }
 $img = $weObj->getQRUrl($ticket);
 $mysql::query($sql);
 echo "<img src='{$img}'>";
 echo "<br>";
 echo "ps: expired after 30 min";
 echo "<br>";
 echo "<br>";
 echo "cellphone just followed the Wechat.......";
 ?>
 <img id="testImg" style="display:none">
 <script>
     var testImg = document.getElementById('testImg');
     testImg.src = 'http://www.ubnt.com.cn/static/images/promos-content-left.png?v=' + (+ new Date());
     var timer = setInterval(function(){
         testImg.src = 'http://www.ubnt.com.cn/static/images/promos-content-left.png?v=' + (+ new Date());
     }, 2000);
開發者ID:blackzw,項目名稱:auth,代碼行數:31,代碼來源:index.php

示例2: http_get

    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)
{
    $oCurl = curl_init();
開發者ID:MiaoMiaosha,項目名稱:bike,代碼行數:31,代碼來源:getQrcode.php


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