[英]Dynamic mpdf filename
I am trying to create dynamic pdf file names based on the user who is logged in using mpdf 我正在尝试根据使用mpdf登录的用户创建动态pdf文件名
now in my mind this (or something similar) should work - but doesn't. 现在在我看来这个(或类似的东西)应该有用 - 但不是。
$User = $_POST ['Username']
$filename = $User
$Extension = ".pdf";
$mpdf->Output($filename, $Extension ,'F');
Which returns the error: 哪个返回错误:
mPDF error: Incorrect output destination: .PDF mPDF错误:输出目标不正确:.PDF
and 和
$mpdf->Output($filename $Extension ,'F');
or 要么
$mpdf->Output($filename$Extension ,'F');
doesn't create the file. 不创建文件。
This 这个
$mpdf->Output($filename,'F');
creates the file but without the .pdf
extension 创建文件但没有.pdf
扩展名
Help? 救命?
According to mpdf documentation 根据mpdf文档
$mpdf->Output('filename.pdf','F');
Your code code seems to be ok. 你的代码似乎没问题。 But you missed the extention in your code, try to modify your code with bellow lines. 但是你错过了代码中的扩展,尝试用波纹线修改你的代码。
$filename=$filrname.".pdf";//You might be not adding the extension,
$mpdf->Output($filename,'F');
have you tried to use a string operator to concenate filename and extension? 你试过使用字符串运算符来构建文件名和扩展名吗?
$mpdf->Output($filename . $Extension ,'F');
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.