Php a href不适用于mpdf中的动态url

Php a href不适用于mpdf中的动态url,php,mpdf,Php,Mpdf,我在导出到PDF时遇到锚定标记问题。锚定标记适用于静态url,如http:google.com,但不适用于动态url。我正在使用PDF的mpdf模块 $url = $fullBaseUrl.'/designers/attachment/time/'.$value['filetime'].'/uploadTab/imgattach'; // http://localhost/msme_latest/designers/attachment/time/1394432246/uploadTab/im

我在导出到PDF时遇到锚定标记问题。锚定标记适用于静态url,如http:google.com,但不适用于动态url。我正在使用PDF的mpdf模块

$url = $fullBaseUrl.'/designers/attachment/time/'.$value['filetime'].'/uploadTab/imgattach'; 
// http://localhost/msme_latest/designers/attachment/time/1394432246/uploadTab/imgattach     

$html= '<a href="'.$url.'">'.$value['filename'].'</a>';        

// echo $html; die;

$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
$url=$fullBaseUrl./designers/attachment/time/.$value['filetime']./uploadTab/imgattach';
// http://localhost/msme_latest/designers/attachment/time/1394432246/uploadTab/imgattach     
$html='';
//echo$html;死亡
$mpdf->WriteHTML($html);
$mpdf->Output();
出口
当我回显代码$html时,它正确地给出了我的链接。但是当我以PDF格式导出代码时,它没有给出任何PDF格式的链接。
欢迎提供任何帮助。

请使用Ip地址而不是本地主机,或者使用对我有效的实时服务器url

<?php
$fullBaseUrl = "http://127.0.0.1/meme_latest";
$url = $fullBaseUrl.'/designers/attachment/time/'.$value['filetime'].'/uploadTab/imgattach'; 
            //(http://localhost/msme_latest/designers/attachment/time/1394432246/uploadTab/imgattach)     
            $html= '<a href="'.$url.'">Test link</a>';        

            //echo $html; die;

include("../mpdf.php");

$mpdf=new mPDF(); 

$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>      

使用Ip地址而不是本地主机,或者使用实时服务器url,这对我来说很有用

<?php
$fullBaseUrl = "http://127.0.0.1/meme_latest";
$url = $fullBaseUrl.'/designers/attachment/time/'.$value['filetime'].'/uploadTab/imgattach'; 
            //(http://localhost/msme_latest/designers/attachment/time/1394432246/uploadTab/imgattach)     
            $html= '<a href="'.$url.'">Test link</a>';        

            //echo $html; die;

include("../mpdf.php");

$mpdf=new mPDF(); 

$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
?>      

要解决此问题,您必须在mpdf.php中进行更改

实际代码在第20146行的mpdf.php中

if(isset($vetor[1]) and $vetor[1] != '') //LINK
{
  if (strpos($vetor[1],".") === false && strpos($vetor[1],"@") !== 0) //assuming every external link has a dot indicating extension (e.g: .html .txt .zip www.somewhere.com etc.) 
  {
    //Repeated reference to same anchor?
    /*
    while(array_key_exists($vetor[1],$this->internallink)) $vetor[1]="#".$vetor[1];
        $this->internallink[$vetor[1]] = $this->AddLink();
        $vetor[1] = $this->internallink[$vetor[1]];
    */
  }
  $this->HREF = $vetor[1];                  // HREF link style set here ******
}
您只需要注释代码行(行号:20151到20153)


您的pdf将接受所有链接,包括“localhost”和其他外部链接。

要解决此问题,您必须在mpdf.php中进行更改

实际代码在第20146行的mpdf.php中

if(isset($vetor[1]) and $vetor[1] != '') //LINK
{
  if (strpos($vetor[1],".") === false && strpos($vetor[1],"@") !== 0) //assuming every external link has a dot indicating extension (e.g: .html .txt .zip www.somewhere.com etc.) 
  {
    //Repeated reference to same anchor?
    /*
    while(array_key_exists($vetor[1],$this->internallink)) $vetor[1]="#".$vetor[1];
        $this->internallink[$vetor[1]] = $this->AddLink();
        $vetor[1] = $this->internallink[$vetor[1]];
    */
  }
  $this->HREF = $vetor[1];                  // HREF link style set here ******
}
您只需要注释代码行(行号:20151到20153)


您的pdf将接受所有链接,包括“localhost”和其他外部链接。

Bro!你真是天才!兄弟!你真是天才!