我正在使用http://phpqrcode.sourceforge.net/来生成二维码。但是这里有一个问题,就是我生成二维码时,但是二维码会自动保存在$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.'" />';
?>