微信二维码生成

WBOY
Libérer: 2016-07-30 13:29:52
original
1612 Les gens l'ont consulté

生成二维码的函数

<code><span>public</span><span><span>function</span><span>actionGenerateQrcode</span><span>()</span>
{</span><span>//获取设备id</span><span>$data</span>[<span>'device_id'</span>] = <span>$this</span>->getQuery(<span>'deviceid'</span>);
    <span>// require_once ($lib_file);</span>
    Yii::import(<span>'application.modules.Libraries.*'</span>);
    <span>$lib_file</span> = <span>'qrcode/phpqrcode.php'</span>;
    <span>require_once</span> (<span>$lib_file</span>);
    <span>// 纠错级别:L、M、Q、H</span><span>$errorCorrectionLevel</span> = <span>'M'</span>;
    <span>// 点的大小:1到10,2.6(64*64)</span><span>$matrixPointSize</span> = <span>5</span>;
    <span>$device</span> = DeviceComponent::shake(<span>$this</span>->accesstoken)->listbydevice(<span>$data</span>);
    <span>$url</span> = <span>$this</span>->generatedeviceurl(<span>$device</span>[<span>'devices'</span>][<span>0</span>]);
    QRcode::png(<span>$url</span>, <span>false</span>, <span>$errorCorrectionLevel</span>, <span>$matrixPointSize</span>, <span>2</span>);
    <span>exit</span>;
}</code>
Copier après la connexion

生成二维码所需链接

<code><span>public</span><span><span>function</span><span>generatedeviceurl</span><span>(<span>$data</span> = array<span>()</span>)</span>
{</span><span>$url</span> = <span>"https://zb.weixin.qq.com/nearby/device/v3/clipboard.xhtml?uuid="</span>.<span>$data</span>[<span>'uuid'</span>].<span>"&major="</span>.<span>$data</span>[<span>'major'</span>].<span>"&minor="</span>.<span>$data</span>[<span>'minor'</span>];
    <span>return</span><span>$url</span>;
}</code>
Copier après la connexion

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了微信二维码生成,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal