//引入插件设置This is my text代表二维码内容
$qrCode = (new QrCode('This is my text'))
->setSize(250)
->setMargin(5)
->useForegroundColor(51, 153, 255);
// saving the result to a file:(将结果保存到文件中:)
//设置保存路径
$qrCode->writeFile(__DIR__ . '/code.png');
// writer在没有指定时默认为PNG
// 直接显示到浏览器
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();