php QRcode::png方法生成的图片指定文件夹

发布时间:2024-03-18 11:44:14    发布者:文昌文城莱奥网络技术工作室    浏览次数:112

// 创建目标文件夹
$folderPath = 'path/to/folder/';
if (!file_exists($folderPath)) {
    mkdir($folderPath, 0777, true);
}

// 生成二维码图片
QRcode::png('Hello World', 'temp_qrcode.png');

// 将生成的图片移动到目标文件夹
rename('temp_qrcode.png', $folderPath . 'qrcode.png');