在运行第三方php应用程序时,我收到此类警告:Warning: DOMNode::cloneNode(): ID mainBodyArea already defined in /libraries/content-extractor/ContentExtractor.php on line 676
接着是另一个警告:
Warning: Cannot modify header information - headers already sent by (output started at libraries/content-extractor/ContentExtractor.php:676) in libraries/feedwriter/FeedWriter.php on line 103
if (isset($this->body)) $this->body = $this->body->cloneNode(true);
$success = $this->readability->init();
第103行附近的FeedWriter.php中的行
header('Content-type: application/json; charset=UTF-8');
$this->json = new stdClass();
我被困在这里几个小时,因为如果这样。我是php概念的新手。 请帮帮我。
答案 0 :(得分:5)
我没有完全得到这个错误,但刚刚修复了一些非常相似的东西,我的。
DOMNode::cloneNode() [<a href='domnode.clonenode'>domnode.clonenode</a>]: ID header already defined in dompdf/include/frame_decorator.cls.php on line 128
我正在使用html制作pdf:
$html = '<html><head>
<style>
@page { font-family:Arial, Helvetica, sans-serif; margin:0px; }
#header { position: fixed; left: 0px; top: 50px; right: 0px; height: 70px; text-align: center; }
#footer { position: fixed; left: 0px; bottom: 50px; right: 0px; height: 70px; text-align: center; }
#content { position: fixed; left: 0px; top: 160px; right: 0px; text-align:center; height:934px; width:934px; }
</style>
</head>
<body>
<div id="header">
header content
</div>
<div id="content">
main content
</div>
<div id="footer">
footer content
</div>
</body>
</html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->output();
要解决问题,我所做的就是将id更改为类:
$html = '<html><head>
<style>
@page { font-family:Arial, Helvetica, sans-serif; margin:0px; }
.header { position: fixed; left: 0px; top: 50px; right: 0px; height: 70px; text-align: center; }
.footer { position: fixed; left: 0px; bottom: 50px; right: 0px; height: 70px; text-align: center; }
.content { position: fixed; left: 0px; top: 160px; right: 0px; text-align:center; height:934px; width:934px; }
</style>
</head>
<body>
<div class="header">
header content
</div>
<div class="content">
main content
</div>
<div class="footer">
footer content
</div>
</body>
</html>';
我希望这可以帮助或让您更接近解决问题!