0

我正在尝试将 DOMPDF 集成到我们的 Joomla(版本 1.5.24)项目中,但我不断收到以下错误:

    Strict standards: Non-static method JLoader::load() should not be called statically in C:\xampp\htdocs\proj\libraries\loader.php on line 162
    Strict standards: Non-static method JLoader::register() should not be called statically in C:\xampp\htdocs\proj\libraries\loader.php on line 139
    Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\proj\components\com_reports\views\details\view.pdf.php on line 23
    Strict standards: Non-static method JFactory::getDBO() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\session\storage\database.php on line 84
    Strict standards: Non-static method JTable::getInstance() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\session\storage\database.php on line 89
    Strict standards: Non-static method JFactory::getDBO() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\database\table.php on line 112

实例化 DOMPDF 对象的函数位于组件的视图之一中:

class ReportsViewDetails extends JView{
  function display($tpl = null){
    global $mainframe;
    //echo "hello";
    $this->generatePDF();
   }

  function generatePDF(){
    require_once("./components/com_reports/helper/dompdf/dompdf_config.inc.php");

    $html =
      '<html><body>'.
      '<p>Put your html here, or generate it with your favourite '.
      'templating system.</p>'.
      '</body></html>';

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream("sample.pdf");
   }
}

它会看到所需的文件,但 dompdf_config.inc.php 会输出上述错误。我不确定是什么原因造成的,因为该文件只包含define行和一个autoload函数。该文件的内容可以在这里看到:http ://code.google.com/p/dompdf/source/browse/trunk/dompdf/dompdf_config.inc.php 。

请帮忙!谢谢!

4

1 回答 1

1

您收到的所有这些严格的标准警告都是因为这条线

错误报告(E_STRICT | E_ALL);

在 dompdf_config.inc.php 中

你应该包括 dompdf/include/dompdf.cls.php

于 2012-01-03T20:03:02.123 回答