Php 如何在dompdf中加载smarty模板的外部样式表

Php 如何在dompdf中加载smarty模板的外部样式表,php,pdf-generation,smarty,dompdf,Php,Pdf Generation,Smarty,Dompdf,我正在尝试使用dompdf从smarty模板生成pdf文件: 代码如下:- require_once('dompdf/dompdf_config.inc.php'); $dompdf = new DOMPDF(); $dompdf->load_html($smarty->fetch(CURRENT_TEMPLATE.'/module/shopping_cart.html')); $dompdf->render(); $dompdf->stream("sample.pdf"

我正在尝试使用dompdf从smarty模板生成pdf文件: 代码如下:-

require_once('dompdf/dompdf_config.inc.php');
$dompdf = new DOMPDF();
$dompdf->load_html($smarty->fetch(CURRENT_TEMPLATE.'/module/shopping_cart.html'));
$dompdf->render();
$dompdf->stream("sample.pdf");
我得到的是pdf文件。但是我得到的是没有任何样式的pdf文件,我发现dompdf没有加载外部样式表。那么如何在smarty模板中加载外部样式表呢


提前感谢

您正在使用
$dompd->load->html()
。因此,相对于本地文件系统中的PHP文档加载样式,而不是相对于web服务器根。最简单的修复方法是在引用外部样式时包含完整的URL(例如)