简体   繁体   English

我有一个带有精确值的二维码输出,但我不知道如何存储生成的图像。 如何存储二维码图像?

[英]I've got a qr code output with an exact value but I don't know how to store the generated image. How can I store a qr-code image?

In the code I have a value string as a test and I am getting an output once I scan qr-code.在代码中,我有一个值字符串作为测试,一旦我扫描了二维码,我就会得到一个输出。 I would like to store that qr-code image in a folder.我想将该二维码图像存储在一个文件夹中。

include 'phpqrcode/qrlib.php';
$value = "test";
if($count > 0)
{                 
     QRcode::png('code data text', 'filename.png'); // creates file 
     $result = QRcode::png($values); // creates code image and outputs it 
                                                directly into browser
}

You have 3 options,你有3个选择,

  1. Just store the coded data text in a file or database只需将coded data text存储在文件或数据库中
  2. Store the qrcode binary in a database ( QRcode::text($codeContents) )将二维码二进制存储在数据库中( QRcode::text($codeContents)
  3. Store the qrcode to a file like @DarkBee said QRcode::png($codeContents, $pngAbsoluteFilePath);将二维码存储到一个文件中,例如@DarkBee 说QRcode::png($codeContents, $pngAbsoluteFilePath);

Good luck!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM