dompdf 无法从我的网站页面生成 pdf。不过,我已经保存了该页面并将其作为简单的静态 html 文件上传,并且它有效!
所以,我不知道问题是否出在 url 上,还是其他什么问题。这是我得到的错误:
警告:require_once(/home/o110334/public_html/dompdf/include/firephp.cls.php)[function.require-once]:无法打开流:/home/o110334/public_html/dompdf/dompdf_config中没有这样的文件或目录.inc.php 第 194 行
致命错误:require_once() [function.require]:无法打开所需的'/home/o110334/public_html/dompdf/include/firephp.cls.php'(include_path='.:/usr/lib/php:/usr/local /lib/php') 在 /home/o110334/public_html/dompdf/dompdf_config.inc.php 第 194 行
这是代码:
$file = "admin/store/orders/45/invoice/print"; // doesn't work
//$file = "invoice_sample2.html"; //it works (same web page, but stored in a html file)
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->render();
$dompdf->stream("sample.pdf");
DOMPDF 在本地运行时会尝试各种东西/评估,你最好尝试:
1)通过http请求HTML(当然,长途旅行):
$dompdf->load_html_file('http://yourdomain.ext/'.$file);
2) 不要让 DOMPDFeval
但使用输出缓冲本身,并让 DOMPDF 加载生成的 HTML 字符串。
<?php
ob_start();
//be sure this file exists, and works outside of web context etc.)
require("admin/store/orders/45/invoice/print");
$dompdf = new DOMPDF();
$dompdf->load_html(ob_get_clean());
$dompdf->render();
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)