无法使用Yii写入mPDF临时文件 [英] mPDF temporary file is not writable using Yii
本文介绍了无法使用Yii写入mPDF临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图以PDF格式打印证书,但是当我将代码推送到暂存时,它说
I tried to print a certificate in PDF but when I push my code to staging, it said
Temporary files directory "/var/www/protected/vendor/mpdf/mpdf/src/Config/../../tmp" is not writable
我不确定如何更改权限以及如何更改自定义目录.
I'm not sure how to change the permission and how to change the custom directory.
这是我单击按钮以获取证书的代码:
Here's my code of a button to click to get the certificate:
<a class="btn btn-sd btn-sd-ghost btn-sd-ghost-black margin-right-lg" href="<?php echo $this->createUrl('//idea/frontend/pdf', array('id'=>$model->id))?>" target="_blank">Get Your Certificate<i class="icon-right-small"></i></a>
<?php endif; ?>
这是控制器:
public function actionPdf($id){
$model = HUB::getOrganization($id);
$orgtitle = $model->title;
$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => 'A4-L']);
$mpdf->WriteHTML("<html><body style='background-image:url(\"/images/cert-idea.jpg\"); background-image-resize: 5; background-position: top center;'></body></html>");
$mpdf->WriteHTML("<div style='text-align:center; display:table; height:100%; width:100%; padding-top:28%;'><h1 style='display:table-cell; vertical-align:middle; font-size:40px;'>".$orgtitle."</h1></div>");
$mpdf->Output('IDEA-CERT-'.$orgtitle.'.pdf', 'I');
}
希望有人可以帮助解决我的问题.谢谢!
Hope someone can help on my issue. Thank you!
推荐答案
查看全文