如何在PHP中使用fpdf获取pdf文件名?

时间:2017-07-31 09:10:28

标签: php filenames fpdf

我一直试图用fpdf获取pdf文件名,但是没有用。这是我的代码:

use Dompdf\Dompdf;
        if (logged_in() === true) {
        if (isset($_POST['do'],$_POST['create_resume'])) {
            $file = addslashes($_POST['create_resume']);
            require('fpdf/fpdf.php');
            setlocale(LC_CTYPE, 'en_US');
            $pdf = new FPDF();
            $pdf->AddPage();
            $pdf->SetFont('Arial','B',16);

            $file = iconv('UTF-8', 'ASCII//TRANSLIT', $file);

            $pdf->Cell(0, 0, $file);

             //$pdf->Cell(40,10,$_POST['create_resume']);
            $name = $pdf->Output('file.pdf','S');

            $name = pathinfo($name,PATHINFO_FILENAME);
            // $name = $name['filename'];
           //$name = basename($name);
            echo $name;

0 个答案:

没有答案