use Vendor\Func\Func;
use Vendor\Func\Http;
use Vendor\Func\Red;
use Vendor\phpqrcode\phpqrcode;
use Vendor\Qiniu\Qiniu;
public function test()
{
$selfhost = Func::getSelfHost();
vendor('phpqrcode.phpqrcode');
$value = $selfhost . '#/pages/index/reg?rec_code=123456';
$errorCorrectionLevel = 'H';//纠错级别:L、M、Q、H
$matrixPointSize = 10;//二维码点的大小:1到10,手机端一般是4
$QR_name = $_SERVER['DOCUMENT_ROOT'] . '/site_upload/ping.jpg';
\QRcode::png($value, $QR_name, $errorCorrectionLevel, $matrixPointSize );
$qiniu = new Qiniu();
$img = $QR_name;
$ext = pathinfo($img, PATHINFO_EXTENSION);
$name = C('DB_NAME') . '_' .time() . mt_rand() . '.' . $ext;
$s = $qiniu->up($img, $name, C('QINIU.BUCKET'));
$add_img = C('CDN_HOST') . $s['key'];
echo $add_img;
}
相信坚持的力量,日复一日的习惯.