修复代码:
- private function _getCategoryId($catdir){
- if(!strpos($catdir,'/')) {
- $dirname = $catdir;
- }else {
- $dirname = end(explode('/',$catdir));
- $dirlist = explode('/',$catdir);//获取全部栏目用于校验重复栏目
- }
- $this->category_db = pc_base::load_model('category_model');
- $this->siteid = get_siteid();
- $CATEGORYS = getcache('category_content_' . $this->siteid, 'commons');
- //$result = $this->category_db->get_one(array('catdir'=>$dirname));
- $res = $this->category_db->select(array('catdir'=>$dirname),'*','','listorder desc');
- if(count($res) > 1){
- $end2 = $dirlist[count($dirlist)-2];
- $res2 = $this->category_db->get_one(array('catdir'=>$end2));
- foreach($res as $k =>$r){
- $pid = $r['parentid'];
- if($CATEGORYS[$pid]['catdir'] == $end2){
- $catid = $r['catid'];
- break;
- }
- }
- }else{
- $catid = $res[0]['catid'];
- }
- return $catid;
- }
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 lecms, classcms, fastadmin, pbootcms, phpcms, eyoucms, yzmcms, xunruicms, jizhicms, wordpress, hkcms, yzncms, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。