我正在尝试使用fpdf
创建一个pdf但是当我在localhost上运行它时,我没有遇到任何问题
但是当我在worpdress服务器上运行时,我收到以下错误:
Warning: fopen() [function.fopen]: open_basedir restriction in effect. File(/home/a1302477/public_html/wp-content/plugins/roque/fpdf/font/unifont/DejaVuSansCondensed.ttf) is not within the allowed path(s): (/home/u541784927:/tmp:/var/tmp:/opt/php-5.3/pear) in /home/u541784927/public_html/wp-content/plugins/roque/fpdf/font/unifont/ttfonts.php on line 496
Warning: fopen(/home/a1302477/public_html/wp-content/plugins/roque/fpdf/font/unifont/DejaVuSansCondensed.ttf) [function.fopen]: failed to open stream: Operation not permitted in /home/u541784927/public_html/wp-content/plugins/roque/fpdf/font/unifont/ttfonts.php on line 496
Can't open file /home/a1302477/public_html/wp-content/plugins/roque/fpdf/font/unifont/DejaVuSansCondensed.ttf
如何解决此问题,请帮助
创建pdf我正在使用代码
require('fpdf/tfpdf.php');
echo $quix = $_POST['quizzz'];
$pdf = new tFPDF();
$questions = $_POST['question'];
$count = count($questions);
$quests = "";
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',14);
$pdf->SetFont('times','',12);
$pdf->SetTextColor(50,60,100);
$pdf->AddPage('P');
//$pdf->SetDisplayMode(real,'default');
$pdf->SetFontSize(12);
for($i=1;$i<=$count;$i++)
{
$qus_id = $questions[$i-1];
$get_q = "select * from `SelleXam_question` where `id`='$qus_id'";
$get_q = $wpdb->get_results($get_q);
$questf = "Quest $i : ".$get_q[0]->question;
$pdf->Cell(0, 10, iconv('UTF-8', 'ISO-8859-2', $questf)."\n"); if($get_q[0]->image !=='') { $pdf->Ln(); $path = plugins_url(); $imagenurl = $path.'/roque/uploads/'.$get_q[0]->image; $pdf->Cell(0, 10, $pdf->Image($imagenurl,$pdf->GetX()+60, $pdf->GetY() + 5,50,50), 0, 0, 'L',''); }
$questf = "Option 1 : ".$get_q[0]->op1;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 2 : ".$get_q[0]->op2;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 3 : ".$get_q[0]->op3;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$questf = "Option 4 : ".$get_q[0]->op4;
$pdf->Ln();
$pdf->Cell(0, 10, $questf."\n");
$pdf->Ln();
$pdf->Ln();