生成二维码的函数
public function actionGenerateQrcode()
{
$data['device_id'] = $this->getQuery('deviceid');
Yii::import('application.modules.Libraries.*');
$lib_file = 'qrcode/phpqrcode.php';
require_once ($lib_file);
$errorCorrectionLevel = 'M';
$matrixPointSize = 5;
$device = DeviceComponent::shake($this->accesstoken)->listbydevice($data);
$url = $this->generatedeviceurl($device['devices'][0]);
QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize, 2);
exit;
}
生成二维码所需链接
public function generatedeviceurl($data = array())
{
$url = "https://zb.weixin.qq.com/nearby/device/v3/clipboard.xhtml?uuid=".$data['uuid']."&major=".$data['major']."&minor=".$data['minor'];
return $url;
}