// 1,下载第三方包// composer require endroid/qr-code/* ================================== *//* =========== success ============== */// 新建一个函数functionQR_CODE(){// Create a basic QR code$qrCode=newQrCode('Life is too short to be generating QR codes');$qrCode->setSize(300);// Set advanced options$qrCode->setWriterByName('png');$qrCode->setMargin(10);$qrCode->setEncoding('UTF-8');$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH());$qrCode->setForegroundColor(['r'=>0,'g'=>0,'b'=>0,'a'=>0]);$qrCode->setBackgroundColor(['r'=>255,'g'=>255,'b'=>255,'a'=>0]);$qrCode->setLogoSize(150,200);$qrCode->setRoundBlockSize(true);$qrCode->setValidateResult(false);$qrCode->setWriterOptions(['exclude_xml_declaration'=>true]);// Directly output the QR codeheader('Content-Type: '.$qrCode->getContentType());echo$qrCode->writeString();// Save it to a file$qrCode->writeFile(__DIR__.'/qrcode.png');exit();}