我在日志文件中看到以下条目:
2013-08-28T17:45:09+00:00 ERR (3): Warning: include(DOMPDF.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/site/site.com/lib/Varien/Autoload.php on line 93
2013-08-28T17:45:09+00:00 ERR (3): Warning: include(DOMPDF.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/site/site.com/lib/Varien/Autoload.php on line 93
2013-08-28T17:45:09+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'DOMPDF.php' for inclusion (include_path='/home/site/site.com/app/code/local:/home/site/site.com/app/code/community:/home/site/site.com/app/code/core:/home/site/site.com/lib:.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/site/site.com/lib/Varien/Autoload.php on line 93
2013-08-28T17:45:09+00:00 ERR (3): Warning: include(Stylesheet.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/site/site.com/lib/Varien/Autoload.php on line 93
2013-08-28T17:45:09+00:00 ERR (3): Warning: include(Stylesheet.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/site/site.com/lib/Varien/Autoload.php on line 93
DOMPDF_autoload函数未执行的原因是什么? 感谢。
答案 0 :(得分:1)
文件DOMPDF.php
不是任何标准Magento安装的一部分。您或您的系统上的某个人在您的Magento系统中注入了一些自定义代码。
在这个自定义代码的某处,有一行看起来像这样
$objet = new DOMPDF;
由于尚未定义此DOMPDF对象,因此PHP会尝试通过其自动加载器运行它。 Magento类的自动加载器在队列中是“第一个”,并且像对待Magento类一样对待DOMPDF。
这意味着尝试包含文件DOMPDF.php
。由于此类不是 Magento类,因此自动加载器失败。 Magento的自动加载器不会优雅地失败,您会看到错误。
您需要确保正确包含DOMPDF中的所有文件。有很多方法可以做到这一点 - 我会联系开展初始工作的开发人员或构建扩展的开发人员,并让他们记录他们如何包含这个库。
答案 1 :(得分:0)
我通过编辑/lib/dompdf6/include/autoload.inc.php解决了这个问题。该文件的内容是:
function DOMPDF_autoload($class) {
$filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
if ( is_file($filename) )
require_once($filename);
}
spl_autoload_register('DOMPDF_autoload');
这篇博客文章非常有帮助。 http://sim.plified.com/2010/11/17/make-dompdf-work-with-magento/
请注意,代码在PHP 5.3.13版上运行。