duancai7002
duancai7002
2014-12-02 05:53
浏览 21

FPDF无法连接

I keep getting this error in a simple php to pdf file

Warning: require(fpdf17/fpdf.php): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/tuto1.php on line 3

Fatal error: require(): Failed opening required 'fpdf17/fpdf.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/tuto1.php on line 3

I keep using the following paths:

define('FPDF_FONTPATH','fpdf17/font/'); require('fpdf17/fpdf.php');

OR

define('FPDF_FONTPATH','/Applications/XAMPP/xamppfiles/htdocs/fpdf17/font/'); require('/Applications/XAMPP/xamppfiles/htdocs/fpdf17/fpdf.php');

I moved the fpdf folder there from the desktop to make it easier since the path from the desktop doen't seem to work either.

Do I need to do something else? It just says on the internet that I just need to path it right. The path seems right, so what's wrong then?

EDIT:

FILE DIRECTORY:

  • Application

    • XAMPP

      • htdocs

        • tuto1.php

        • fpdf17

          • fpdf.php

          • font

tuto1.php code

<?php
define('FPDF_FONTPATH','fpdf17/font/');
require('fpdf17/fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

相关推荐