代码之家  ›  专栏  ›  技术社区  ›  Juan Pablo Bustamante Luna

在fpdf中显示链接

  •  4
  • Juan Pablo Bustamante Luna  · 技术社区  · 9 年前

    当我尝试以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);
    }
    

    这是我的结果

    enter image description here

    我想根据行的结果ID显示类似“查看链接”的内容。但当我在链接上传递指针时,它会显示以下内容

    enter image description here

    非常感谢。

    1 回复  |  直到 9 年前
        1
  •  5
  •   Death-is-the-real-truth    9 年前

    基于链接:- http://www.fpdf.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/doc/cell.htm

    注:-相应地更改参数值。