Php 如何生成二维码而不将二维码图像保存到文件夹中?

Php 如何生成二维码而不将二维码图像保存到文件夹中?,php,image,qr-code,Php,Image,Qr Code,我正在使用生成二维码。但这里有一个问题,当我生成二维码时,二维码会自动保存在$tempDir=“qrcodes/”,所以我想知道如何生成二维码,但文件夹中不会保存任何图像 这是我的代码: <?php include 'phpqrcode.php'; include('phpqrcode/qrlib.php'); // how to save PNG codes to server $uuid

我正在使用生成二维码。但这里有一个问题,当我生成二维码时,二维码会自动保存在
$tempDir=“qrcodes/”
,所以我想知道如何生成二维码,但文件夹中不会保存任何图像

这是我的代码:

<?php 
            include 'phpqrcode.php';
            include('phpqrcode/qrlib.php');

            // how to save PNG codes to server
            $uuid = md5(uniqid());
            $uuidsha1 = sha1($uuid); 

            $codeContents = $uuidsha1;
            $tempDir = "qrcodes/";
            // we need to generate filename somehow, 
            // with md5 or with database ID used to obtains $codeContents...
            $fileName = ''.md5($codeContents).'.png';

            $pngAbsoluteFilePath = $tempDir.$fileName;
            $urlRelativeFilePath = $tempDir.$fileName;

            // generating
            QRcode::png($codeContents, $pngAbsoluteFilePath, QR_ECLEVEL_H, 8, 1, false);

            // displaying
            echo '<img src="'.$urlRelativeFilePath.'" />';

        ?>

不做你想做的事?并分配一个变量,如
$var=''示例1也涵盖了这一点。您可能应该阅读
QRCode::png()
的文档,其中提到
$pngAbsoluteFilePath
是可选的,默认值===false。但是有一个问题,就是二维码图像有时候大,有时候小。另外,背景是黑色的,我如何修改它?