Kirin 99f622c12a 1111 | 2 yıl önce | |
---|---|---|
.. | ||
src | 2 yıl önce | |
README.md | 2 yıl önce | |
composer.json | 2 yıl önce |
The ThinkPHP5 qrcode 二维码生成 SDK
composer require dh2y/think-qrcode
或者
"require": {
"dh2y/think-qrcode":"1.*"
},
"require": {
"dh2y/think-qrcode":"2.*"
},
或者
a) 进入vendor/dh2y目录 (没有dh2y目录 mkdir dh2y)
b) git clone
c) 修改 git clone下来的项目名称为think-qrcode
d) 添加下面配置
"autoload": {
"psr-4": {
"dh2y\\qrcode\\": "vendor/dh2y/think-qrcode/src"
}
},
e) php composer.phar update
return [
'cache_dir' => 'uploads'.DS.'qrcode', //缓存地址
'background'=> 'static/image/icon_cover.png' //背景图
];
$code = new QRcode();
$code_path = $code->png($register_url) //生成二维码
->logo('static/image/avatar-m.jpg') //生成logo二维码
->background(180,500) //给二维码加上背景
->text($role,20,['center',740],'#ff4351') //添加文字水印
->text($nick_name,20,['center',780],'#000000')
->getPath(); //获取二维码生成的地址