Php 生成的QRcode未存储在给定的路径中

Php 生成的QRcode未存储在给定的路径中,php,laravel,qr-code,Php,Laravel,Qr Code,使用,我试图生成QRCode并存储它 \QrCode::generate($reservation_id, '/assets/uploads/'.$reservation_id.'.svg'); 返回以下错误 "file_put_contents(/assets/uploads/15525609678807.svg): failed to open stream: No such file or directory", "exception": "ErrorException", "file"

使用,我试图生成QRCode并存储它

\QrCode::generate($reservation_id, '/assets/uploads/'.$reservation_id.'.svg');
返回以下错误

"file_put_contents(/assets/uploads/15525609678807.svg): failed to open stream: No such file or directory",
"exception": "ErrorException",
"file": "/..../vendor/simplesoftwareio/simple-qrcode/src/SimpleSoftwareIO/QrCode/BaconQrCodeGenerator.php",
"line": 85, 

它起作用了


\QrCode::generate($reservation\u id,base\u path().$reservation\u id..svg')

是否您尝试存储二维码的路径不存在?将解释错误消息。也可能是您的路径错误。路径存在,但文件不是存储代码的文件的第二个参数(作为其文档)。谢谢@tim你的资产文件夹在哪里?它是在公用文件夹中还是在直接根目录中。@MayankDudakiya它在根目录中。现在请尝试使用
$public\u path=public\u path('assets/upload')这将为您提供公共路径,然后添加其他内容,如$qr_path=$public_path.'/'.$reservation_id..svg'\QrCode::生成($qr\U路径);另外,请注意公共路径应该是正确的。