php修复第16498行中TCPDF的迷你错误:未定义的索引:thread

时间:2015-06-15 08:24:57

标签: tcpdf

创建pdf时可能会出现错误,我需要面对它。

  

PHP版本5.3

     

TCPDF版本6.2

if (($dom[$key]['value'] == 'table') AND (!TCPDF_STATIC::empty_string($dom[($dom[$key]['parent'])]['thead'])) ) 
   {
         $dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
        $dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
   }

1 个答案:

答案 0 :(得分:0)

这是只需要检查数组元素的解决方案。

if (array_key_exists ('thead',$dom[($dom[$key]['parent'])]))
{
                    if (($dom[$key]['value'] == 'table') AND (!TCPDF_STATIC::empty_string($dom[($dom[$key]['parent'])]['thead'])) ) {
                    $dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
                    $dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
                    }
}