php 修复 TCPDF 第 16498 行中的小错误:未定义索引:线程

问题描述 投票:0回答:1

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

PHP 版本 5.3

TCPD 版本 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>';
   }
php tcpdf
1个回答
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>';
                    }
}
© www.soinside.com 2019 - 2024. All rights reserved.