微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

警告:尝试访问 C:\xampp\htdocs\wordpress2\wp-content\themes\sport-ak\framework 中类型 bool 值的数组偏移量

如何解决警告:尝试访问 C:\xampp\htdocs\wordpress2\wp-content\themes\sport-ak\framework 中类型 bool 值的数组偏移量

警告:尝试访问布尔类型值的数组偏移

警告: 尝试访问 C:\xampp\htdocs\wordpress2\wp-content\themes\sport-ak\framework\class.category-custom- 中类型 bool 值的数组偏移量fields.PHP 第 133 行

这里是第 133 行:

return isset($key) ? $cat_Meta[$key] : '';

这是完整的:

public function get_category_Meta($term_id,$key) {
        if (!$term_id)
            return;

        $cat_Meta = get_option("category_$term_id");

        return isset($key) ? $cat_Meta[$key] : '';

解决方法

第 133 行检查变量 $key 是否存在,如果存在,它会尝试从不同的变量返回一些内容:$cat_meta

您应该检查变量 $cat_meta[$key] 是否存在,如下所示:

return isset($cat_meta[$key]) ? $cat_meta[$key] : '';

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。