本文整理汇总了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);
示例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();