phpcms 杂乱总结

时间:2021-12-14 20:25:40

1.根据catid 获取 栏目名称

$CATEGORYS = getcache('category_content_'.$siteid,'commons');
$name = {$CATEGORYS[$catid]['catname']}

2.根据catid 取子栏目的catid和名称

/*
* 根据catid 取子栏目
*/
private function get_child_catid($parents_catid){
$categorys = getcache('category_content_1','commons');
$arrchildid = $categorys[$parents_catid][arrchildid];
$arrchildid = explode(',',$arrchildid);
$result = array();
foreach($arrchildid as $k=>$v){
$name = $categorys[$v]['catname'];
$result[$k]['catid']=$v;
$result[$k]['catname']=$name;
}
$result = array_slice($result,1);
return $result;
}