Php mPDF-仅第一页的页眉,但每页的页脚

Php mPDF-仅第一页的页眉,但每页的页脚,php,html,pdf,mpdf,Php,Html,Pdf,Mpdf,我只需要为第一页设置页眉,为每一页设置页脚。找不到办法,我已经找了好几天了。目前我的代码是这样的 $mpdf=new mPDF(); $mpdf->useOddEven = true; $mpdf->SetHTMLHeader('<div style="text-align: right;"><img src="var:images" width="80px"/></div>', 'O'); $mpdf->SetHTMLFooter(

我只需要为第一页设置页眉,为每一页设置页脚。找不到办法,我已经找了好几天了。目前我的代码是这样的

$mpdf=new mPDF();

$mpdf->useOddEven = true;

$mpdf->SetHTMLHeader('<div style="text-align: right;"><img src="var:images" 
width="80px"/></div>', 'O');

$mpdf->SetHTMLFooter('<div style="text-align: left; font-family: Arial, Helvetica,
sans-serif; font-weight: bold;font-size: 7pt; ">Footer</div>');

$html = 'Content';
$mpdf->WriteHTML($html);
$mpdf->Output();
$mpdf=新的mpdf();
$mpdf->UseOdd偶数=真;
$mpdf->SetHTMLHeader('O');
$mpdf->SetHTMLFooter('Footer');
$html='Content';
$mpdf->WriteHTML($html);
$mpdf->Output();
我已经将页眉设置为奇数,但是页眉和页脚都显示在另一个奇数页(3、5、7、…页)上。有没有办法使页眉只出现在第一页,而页脚却出现在每一页


根据文档,当前正在使用MPDF5.6

第三个参数是:

所以

$mpdf->SetHTMLHeader('O',true);
$mpdf->SetHTMLHeader(“”);
$footer=数组(
'L'=>数组(
'内容'=>'页脚',
“字体大小”=>7,
“字体样式”=>“B”,
“字体系列”=>“Arial、Helvetica、无衬线”,
“颜色”=>“#000000”
),
'C'=>数组(
'内容'=>'',
“字体大小”=>10,
“字体样式”=>“B”,
“字体系列”=>“衬线”,
“颜色”=>“#000000”
),
'R'=>数组(
'内容'=>'',
“字体大小”=>10,
“字体样式”=>“B”,
“字体系列”=>“衬线”,
“颜色”=>“#000000”
),
“行”=>1,
);
$mpdf->SetFooter($footer);
只有SetFooter方法可以为奇数页和偶数页的页脚设置

write
If TRUE it forces the Header to be written immediately to the current page. Use if the header is being set after the new page has been added.
DEFAULT: FALSE
$mpdf->SetHTMLHeader('<div style="text-align: right;"><img src="var:images" width="80px"/></div>', 'O', true);
$mpdf->SetHTMLHeader('');
$footer = array (
    'L' => array (
      'content' => 'Footer',
      'font-size' => 7,
      'font-style' => 'B',
      'font-family' => 'Arial, Helvetica, sans-serif',
      'color'=>'#000000'
  ),
    'C' => array (
      'content' => '',
      'font-size' => 10,
      'font-style' => 'B',
      'font-family' => 'serif',
      'color'=>'#000000'
    ),
    'R' => array (
      'content' => '',
      'font-size' => 10,
      'font-style' => 'B',
      'font-family' => 'serif',
      'color'=>'#000000'
    ),
'line' => 1,
);
$mpdf->SetFooter($footer);