WordPress结果的setapdf合并,带有错误“标题已发送到”
我正在使用 setapdf serger 我几乎完成了我的项目,它为我的WordPress网站提供了成就。但是,我当然遇到了Trubble。我在Metabox中有一个可重复的字段,该字段将发送URL,因此将合并文件雕刻而成。 为什么我会遇到这个错误?请帮助我。
$autopro = get_post_meta( get_the_ID(), '_da_attachments', true);
$merger = new SetaPDF_Merger();
$merger->addFile([
'filename' => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf",
'outlinesConfig' => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);
if ( $autopro ) {
foreach ( $autopro as $auto ) {
echo
'
$merger->addFile([
"filename" => realpath(__DIR__ . "/../../../../") . "';
echo parse_url(wp_get_attachment_url($auto ['file_id']) , PHP_URL_PATH);
echo '",
"outlinesConfig" => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);';
}
}
我的错误日志显示:
$merger->addFile([ "filename" => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf", "outlinesConfig" => [ SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT ] ]);
$merger->addFile([ "filename" => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/A-merry-Christmas.pdf", "outlinesConfig" => [ SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT ] ]);
Fatal error: Uncaught SetaPDF_Core_Writer_Exception: Headers already been send in /home2/notparti/public_html/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php on line 137 in /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Writer/Http.php:100 Stack trace: #0 /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Document.php(1715): SetaPDF_Core_Writer_Http->finish() #1 /home2/notparti/public_html/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php(168): SetaPDF_Core_Document->finish() #2 /home2/notparti/public_html/wp-includes/class-wp-hook.php(307): dkpdf_output_pdf(Object(WP)) #3 /home2/notparti/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home2/notparti/public_html/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #5 /home2/notparti/public_html/wp-includes/class-wp.php(771): do_action_ref_array('wp', Array) #6 /home2/notparti/public_html/wp-includes/functions.php(1310): WP->main('') #7 /home2/notparti/public_html/wp-blog- in /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Writer/Http.php on line 100
如果我替换循环(第一个代码示例),
$merger->addFile([
'filename' => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf",
'outlinesConfig' => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);
则它可以正常工作……为什么不能使用循环?
I am using SetaPDF Merger and I am almost finished with my project to set it up for my WordPress site. But of course I run into trubble. I have a repeatable field in a metabox that will send the url so that it engraves a merge file as a result.
Why am I getting this error? Please help me out.
$autopro = get_post_meta( get_the_ID(), '_da_attachments', true);
$merger = new SetaPDF_Merger();
$merger->addFile([
'filename' => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf",
'outlinesConfig' => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);
if ( $autopro ) {
foreach ( $autopro as $auto ) {
echo
'
$merger->addFile([
"filename" => realpath(__DIR__ . "/../../../../") . "';
echo parse_url(wp_get_attachment_url($auto ['file_id']) , PHP_URL_PATH);
echo '",
"outlinesConfig" => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);';
}
}
My error log shows:
$merger->addFile([ "filename" => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf", "outlinesConfig" => [ SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT ] ]);
$merger->addFile([ "filename" => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/A-merry-Christmas.pdf", "outlinesConfig" => [ SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT ] ]);
Fatal error: Uncaught SetaPDF_Core_Writer_Exception: Headers already been send in /home2/notparti/public_html/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php on line 137 in /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Writer/Http.php:100 Stack trace: #0 /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Document.php(1715): SetaPDF_Core_Writer_Http->finish() #1 /home2/notparti/public_html/wp-content/plugins/dk-pdf/includes/dkpdf-functions.php(168): SetaPDF_Core_Document->finish() #2 /home2/notparti/public_html/wp-includes/class-wp-hook.php(307): dkpdf_output_pdf(Object(WP)) #3 /home2/notparti/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home2/notparti/public_html/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #5 /home2/notparti/public_html/wp-includes/class-wp.php(771): do_action_ref_array('wp', Array) #6 /home2/notparti/public_html/wp-includes/functions.php(1310): WP->main('') #7 /home2/notparti/public_html/wp-blog- in /home2/notparti/public_html/wp-content/plugins/dk-pdf/vendor/SetaPDF/Core/Writer/Http.php on line 100
If I replace the loop (first code example) with
$merger->addFile([
'filename' => realpath(__DIR__ . "/../../../../") . "/wp-content/uploads/2022/03/Valsignelsen.pdf",
'outlinesConfig' => [
SetaPDF_Merger::OUTLINES_COPY => SetaPDF_Merger::COPY_OUTLINES_TO_ROOT
]
]);
Then it’s working properly… Why can’t I use the loop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论