Php Dompdf-Get';未定义的属性:DOMText::$data';
我们已经使用dompdf好几个月了,没有任何问题。最近,我们在服务器(Ubuntu 16.04)上遇到了一些其他问题,在修复这些问题并重新启动之后。DOMDocument似乎已经消失了,我们重新安装了它(在PHP7.0上)。但我们无法让它再次工作 我们的守则:Php Dompdf-Get';未定义的属性:DOMText::$data';,php,dompdf,Php,Dompdf,我们已经使用dompdf好几个月了,没有任何问题。最近,我们在服务器(Ubuntu 16.04)上遇到了一些其他问题,在修复这些问题并重新启动之后。DOMDocument似乎已经消失了,我们重新安装了它(在PHP7.0上)。但我们无法让它再次工作 我们的守则: $dompdf = new Dompdf(); $dompdf->loadHtml("hello world"); $dompdf->render(); $dompdf->stream("document"); 在
$dompdf = new Dompdf();
$dompdf->loadHtml("hello world");
$dompdf->render();
$dompdf->stream("document");
在这之后,只会发生以下两件事:
1) 当我们注释$dompdf->stream()行时,它只显示以下消息:
注意:第71行/var/www/project/vendor/dompdf/src/FrameDecorator/Text.php中未定义的属性:DOMText::$data
2) 取消注释时,它只生成空白PDF
我们为此迷失了好几天,任何形式的帮助都将是巨大的
事先非常感谢
问候
如果我们使用
var_dump($this->_frame->get_node());
在消息的第行(/var/www/project/vendor/dompdf/src/FrameDecorator/Text.php)
…它抛出了这样一个:
object(DOMText)#1221 (17) {
["data"]=> string(0) ""
["nodeName"]=> string(5) "#text"
["nodeValue"]=> string(11) "hello world"
["nodeType"]=> int(3)
["parentNode"]=> string(22) "(object value omitted)"
["childNodes"]=> NULL
["firstChild"]=> NULL
["lastChild"]=> NULL
["previousSibling"]=> NULL
["nextSibling"]=> NULL
["attributes"]=> NULL
["ownerDocument"]=> string(22) "(object value omitted)"
["namespaceURI"]=> NULL
["prefix"]=> string(0) ""
["localName"]=> NULL
["baseURI"]=> NULL
["textContent"]=> string(11) "hello world"
}
无论如何,谢谢你的帮助。真的:)我一直在成功地使用domPDF,与您的例程的唯一区别在于
$domPDF->loadHtml(…)
和$dompdf->render()代码>我正在使用设置纸张大小
$dompdf->setPaper('A4', 'portrait');
你可以试着加上这一点-不确定这是否有什么不同。我遇到了这个麻烦,
在我的例子中,我的应用程序在开发环境(windows和windows服务器、apache、php)中工作,但问题发生在produciton(ubuntu 18、nginx、php7.2-fpm)中
当我运行此命令时:php--ini
;我得到以下警告
警告:模块“dom”已加载到第0行的未知中警告:
模块“mbstring”已加载到第0行的未知位置警告:
........................ 警告:模块“xxx”已加载到
第0行未知
因此,我在这些帖子中对它们进行了修复:并且
请记住dompdf
使用php'dom'扩展和其他。因此,如果dompdf
中出现任何问题,则dompdf
将无法工作 在它停止工作之前,我们使用了这些设置。抛出相同的结果。谢谢约翰,我们还在努力。