小编use*_*204的帖子

DOMPDF,给我带来了一个错误

这是我在PdfHtml类中的代码:

public function createTable($result){

    $html = "<html>
                    <body>
                        <table>
                            <th>
                                <td>Descripción</td>
                                <td>Artículo</td>
                                <td>Precio</td>
                            </th>
                        ";
    while($row = mysql_fetch_array($result)){
        $html .= "<tr>";
        $html .= "<td>".$row["producto"]."</td>";
        $html .= "<td>".$row["idProducto"]."</td>";
        $html .= "<td>".$row["precio"]."</td>";
        $html .= "</tr>";
    }

    $html .= "</table>
                </body>
                    </html>";

    return $html;
}
</i>
Run Code Online (Sandbox Code Playgroud)

我执行以下操作:

$pdfHtml = new PdfHTML();
$result = $pdfHtml->getProductosPorMarca($idMarca);
$html = $pdfHtml->createTable($result);

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->output();
Run Code Online (Sandbox Code Playgroud)

抛出这个:

Catchable fatal error: Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode, null given, called in …
Run Code Online (Sandbox Code Playgroud)

html php mysql dompdf

2
推荐指数
1
解决办法
8597
查看次数

标签 统计

dompdf ×1

html ×1

mysql ×1

php ×1