這是我在PdfHtml類代碼:DOMPDF,給我帶來了錯誤
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>
我用下面的執行:
$pdfHtml = new PdfHTML();
$result = $pdfHtml->getProductosPorMarca($idMarca);
$html = $pdfHtml->createTable($result);
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->output();
而拋出這個:
Catchable fatal error: Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode, null given, called in /opt/lampp/htdocs/ONLINE/dompdf0.6/include/table_frame_decorator.cls.php on line 304 and defined in /opt/lampp/htdocs/ONLINE/dompdf0.6/include/frame.cls.php on line 726
請幫助我,我不發現哪裏是我的錯誤!謝謝!!
Ichange此HTML代碼,並給我帶來了這樣:致命錯誤:調用未定義方法399行中的/opt/lampp/htdocs/ONLINE/dompdf0.6/include/cellmap.cls.php中的DOMText :: getAttribute()。 您是否有示例?謝謝 – user1977204 2013-03-03 19:30:45
更新後的代碼示例將有助於弄清楚您的代碼正在發生什麼。您可能還想嘗試驗證您的代碼生成的HTML:http://validator.w3.org – BrianS 2013-03-04 04:48:57