自定义模式下主页有属性无主题报错与解决

敲定吧2022-12-21  469

Error[8]: Undefined index: tids, File: D:\phpstudy_pro\WWW\xxx.com\tmp\route_index.php, Line: 76
File: D:\phpstudy_pro\WWW\xxx.com\tmp\index.inc.php, Line: 95, include(D:\phpstudy_pro\WWW\xxx.com\tmp\route_index.php)
File: D:\phpstudy_pro\WWW\xxx.com\index.php, Line: 29, include(D:\phpstudy_pro\WWW\xxx.com\tmp\index.inc.php)

查看route/index.php 第73-75行

if (!empty($flaglist)) {
    foreach ($flaglist as $key => $val) {
        if (in_array($_thread['tid'], $val['tids'])) { // 报错
            $flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
            ksort($flaglist[$key]['list']);
            // hook index_custom_flag.php
        }
    }
}

改为

if (!empty($flaglist)) {
    foreach ($flaglist as $key => $val) {
        if (!empty($val['tids']) && in_array($_thread['tid'], $val['tids'])) { // 增加判断变量是否为空
            $flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
            ksort($flaglist[$key]['list']);
            // hook index_custom_flag.php
        }
    }
}
转载请注明原文地址:https://www.wellcms.net/read-583.html
11
最新回复(2)