Step 1, First download fpdf http://www.fpdf.org/en/download.php (I use the 1.7 version)
Step 2, download the Chinese package http://www.fpdf.org/download/chinese.zip download After the file is placed in the Step 1 folder with the fpdf.php sibling directory below
Step 3, edit ex.php content as follows
<?PHPrequire(' chinese.php ');$pdf=NewPdf_chinese ();$pdf->addgbfont (' SimSun ', ' song Body '); $pdf->addgbfont (' Simhei ', ' blackbody '); $pdf->addgbfont (' Simkai ', ' italics _gb2312 ')); $pdf->addgbfont (' Sinfang ', ' imitation _gb2312 '); $pdf-Open ();$pdf-AddPage ();$pdf->setfont (' SimSun ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->setfont (' Simhei ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->setfont (' Simkai ', ', 20); $pdf->write (10, ' Simplified Chinese characters ')); $pdf->write (10, ' Simplified Chinese characters ')); $pdf-Output ();?>
You can see the Chinese in the direct preview.
PHP uses fpdf garbled problem