$item) { $array[$key] = $item; } } $ur = ''; if (count($array)) { foreach ($array as $key => $item) { if ($item) { if ($ur) { $ur .= "&$key=" . $item; } else { $ur .= "?$key=" . $item; } } } } return $ur; } } /** * 栏目跳转 */ if (!function_exists('get_cate_url')) { function get_cate_url($category) { //判断是不是外链 if ($category['status'] == 3) { return $category['url']; } //判断是不是一级栏目 $pid = $category['id']; $sid = $category['id']; $get_data = [':pid'=>$pid,':sid'=>$sid]; if ($category['pid'] != 0) { //如果是有父级的 $official_tree_category_url = ADDON_PATH . 'official' . DS . 'config' . DS . 'official_tree_category.php'; if (file_exists($official_tree_category_url)) { $tree_category_all = include $official_tree_category_url; foreach ($tree_category_all as $item) { if ($item['id'] == $category['pid']) { $father_category = $item; } } } if (isset($father_category) && !empty($father_category)) { $pid = $father_category['id']; $get_data = [':pid'=>$pid,':sid'=>$sid]; } } //判断是不是单页 if ($category['status'] == 1) { return addon_url('official/web.official_home/single',$get_data,true,true); } //判断是不是列表 if ($category['status'] == 2) { //生成配置文件 $official_rule_url = ADDON_PATH . 'official' . DS . 'config' . DS . 'official_rule.php'; if (!file_exists($official_rule_url)) { $official_rule = []; $rule_all = db('official_rule')->select(); foreach ($rule_all as $item) { $official_rule[$item['id']] = $item; } file_put_contents( $official_rule_url, '