的下级分类 if($noid) { if(isset($pre)) { if($v['pre'] > $pre) continue; else unset($pre); } if($v['cid'] == $noid) { $pre = $v['pre']; continue; } } $s .= ''; } } return $s; } // 获取指定分类的 mid (如果 cid 为空,则读第一个分类的 mid) public function get_mid_by_cid($cid) { if($cid) { $arr = $this->read($cid); }else{ $arr = $this->get_category(); if(empty($arr)) return 2; $arr = current($arr); $arr = current($arr); } return $arr['mid']; } // 获取分类当前位置 public function get_place($cid) { $p = array(); $tmp = $this->get_category_db(); while(isset($tmp[$cid]) && $v = &$tmp[$cid]) { array_unshift($p, array( 'cid'=> $v['cid'], 'name'=> $v['name'], 'url'=> $this->category_url($v['cid'], $v['alias']) )); $cid = $v['upid']; } return $p; } // 获取分类缓存合并数组 public function get_cache($cid) { $k = 'cate_'.$cid; if(isset($this->data[$k])) return $this->data[$k]; $arr = $this->runtime->xget($k); if(empty($arr)) { $arr = $this->update_cache($cid); } $this->data[$k] = $arr; return $arr; } // 更新分类缓存合并数组 public function update_cache($cid) { $k = 'cate_'.$cid; $arr = $this->read($cid); if(empty($arr)) return FALSE; $arr['place'] = $this->get_place($cid); // 分类当前位置 $arr['topcid'] = $arr['place'][0]['cid']; // 顶级分类CID $arr['table'] = $this->cfg['table_arr'][$arr['mid']]; // 分类模型表名 // 如果为频道,获取频道分类下级CID if($arr['type'] == 1) { $arr['son_list'] = $this->get_cids_by_upid($cid, $arr['mid']); $arr['son_cids'] = array(); if(!empty($arr['son_list'])) { foreach($arr['son_list'] as $c => $v) { if(is_array($v)) { $v && $arr['son_cids'] = array_merge($arr['son_cids'], $v); }else{ $arr['son_cids'][] = $c; } } } } $this->runtime->set($k, $arr); return $arr; } // 删除所有分类缓存 (最多读取2000条,如果缓存太大,需要手工清除缓存) public function delete_cache() { $key_arr = $this->runtime->find_fetch_key(array(), array(), 0, 2000); foreach ($key_arr as $v) { if(substr($v, 10, 5) == 'cate_') { $this->runtime->delete(substr($v, 10)); } } return TRUE; } // 分类链接格式化 public function category_url(&$cid, &$alias, $page = FALSE) { if(empty($_ENV['_config']['twcms_parseurl'])) { return $this->cfg['webdir'].'index.php?cate--cid-'.$cid.($page ? '-page-{page}' : '').$_ENV['_config']['url_suffix']; }else{ if($page) { return $this->cfg['webdir'].$alias.$this->cfg['link_cate_page_pre'].'{page}'.$this->cfg['link_cate_page_end']; }else{ return $this->cfg['webdir'].$alias.$this->cfg['link_cate_end']; } } } } 出错啦!

错误信息

错误位置

基本信息

程序流程

SQL

$_GET

$_POST

$_COOKIE

包含文件

其他信息