在fpdf中显示一个链接[英] Show a link in fpdf

本文是小编为大家收集整理的关于在fpdf中显示一个链接的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

当我尝试在PDF中显示链接时,它不会向我显示链接,但是显示了PHP代码或字符串文本.我该如何更改?

这是我的代码

while($fila2 = mysql_fetch_array($fila)) {
    $item = $item+1;    
    $pdf->Cell(5, 8 ,$item, 1);
    $pdf->Cell(10, 8 ,$fila2['FOLIO'], 1);
    $pdf->Cell(70, 8 ,$fila2['NOMBRE'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_SOLICITUD'])), 1);
    $pdf->Cell(25, 8 ,$fila2['TIPO_AUTORIZACION'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_AUTORIZACION'])), 1);
    $pdf->Cell(20,8 , '<a href="http://www.intranet.com/mb/rprh06/final.php?folio=$fila2["FOLIO"]" target="_blank">Enlace</a>',1); 
    $pdf->Ln(8);
}

,这是我的结果

在此处输入图像说明

我想根据该行的结果ID显示"视图链接"之类的内容.但是当我通过链接上的指针时,它显示以下

在此处输入图像说明

谢谢.

推荐答案

基于链接: - http://www.fppdf.org/en/doc/link.htm

您需要这样写: -

$pdf->Link(100,10,10,10, 'http://www.intranet.com/mb/rprh06/final.php?folio='.$fila2[‌​"FOLIO"]);

或Cell(): -

$pdf->Cell(20,8 ,'','','','',false, "http://www.intranet.com/mb/rprh06/final.php?folio=".$fila2["FOLIO"]); 

参考: - http://www.fpdf.org/en/en/en/doc/cell .htm

注意: - 相应地更改参数值.

本文地址:https://www.itbaoku.cn/post/2090903.html

问题描述

When I try to display a link in pdf it does not show me the link, but the php code or string text are displayed. How can I change that?

This is my code

while($fila2 = mysql_fetch_array($fila)) {
    $item = $item+1;    
    $pdf->Cell(5, 8 ,$item, 1);
    $pdf->Cell(10, 8 ,$fila2['FOLIO'], 1);
    $pdf->Cell(70, 8 ,$fila2['NOMBRE'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_SOLICITUD'])), 1);
    $pdf->Cell(25, 8 ,$fila2['TIPO_AUTORIZACION'], 1);
    $pdf->Cell(25, 8 ,date("d-m-Y",strtotime($fila2['FECHA_AUTORIZACION'])), 1);
    $pdf->Cell(20,8 , '<a href="http://www.intranet.com/mb/rprh06/final.php?folio=$fila2["FOLIO"]" target="_blank">Enlace</a>',1); 
    $pdf->Ln(8);
}

And this is my result

enter image description here

I want to show something like "View Link" according to the result ID of the row. But when I pass the pointer on the link it shows the following

enter image description here

Thank You.

推荐答案

Based on the link:- http://www.fpdf.org/en/doc/link.htm

You need to write like this:-

$pdf->Link(100,10,10,10, 'http://www.intranet.com/mb/rprh06/final.php?folio='.$fila2[‌​"FOLIO"]);

Or with Cell():-

$pdf->Cell(20,8 ,'','','','',false, "http://www.intranet.com/mb/rprh06/final.php?folio=".$fila2["FOLIO"]); 

Reference:- http://www.fpdf.org/en/doc/cell.htm

Note:- change parameters values accordingly.