Laravel生成二维码图片
composer下载组件
https://github.com/SimpleSoftwareIO/simple-qrcode/tree/develop/docs/zh-cn
- composer require simplesoftwareio/simple-qrcode "~2"
复制代码- namespace App\Http\Controllers;
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
- class HomeController extends Controller
- {
- public function hello(){
- return "laravel7";
- }
- public function generatePicture()
- {
- $res= QrCode::format('png')->margin(1)->size(399)->color(40,40,40)->generate('Make me a QrCode!');
- return response()->make($res)->header('Content-Type','image/png');
- }
- }
- Route::get('home/generatePicture','HomeController@generatePicture');
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |