【发布时间】:2019-08-07 05:43:38
【问题描述】:
我正在构建使用 CodeIgniter 和 DOMPDF 生成应用程序的 pdf。它在我的本地主机中工作正常,但是当我将这些文件移动到服务器时,它给了我以下错误。请问,我该如何解决这个问题?
Severity: Warning
Message: file_exists(): open_basedir restriction in effect. File(/tmp/log.htm) is not within the allowed path(s): (/home/admin/web/fryapps.com/public_html:/home/admin/tmp)
Filename: src/Dompdf.php
Line Number: 714
Backtrace:
File: /home/admin/web/fryapps.com/public_html/application/libraries/dompdf/src/Dompdf.php
Line: 714
Function: file_exists
File: /home/admin/web/fryapps.com/public_html/application/controllers/Createpdf.php
Line: 31
Function: render
图片错误路径:https://imgur.com/a/zQo1873
这是我的代码:
$htmlcontent= $this->load->view('admin/test',$data,true);
$this->pdf->loadHtml($htmlcontent);
$this->pdf->render();
$this->pdf->stream("report.pdf",array("Attachment=>0"));
任何人,请帮我解决这个问题?
【问题讨论】:
-
提供绝对路径/home/admin/tmp/
-
@kuh-chan 我必须在哪里编辑这个?
-
如何解决这个问题?
-
当您查看 Dompdf 的代码时,您会发现它会创建一个
logOutputFile。您可以在选项数组中设置它 -
更多
$this->pdf->set_option('logOutputFile', $this->getTempDir() . DIRECTORY_SEPARATOR . 'log.htm');等等...我为什么要为你阅读文档?
标签: php codeigniter dompdf