/**(V3.8 新增)(V6.7 更新) * 设置路由映射 * @param string $m 模块名 */ function set_mapping($m) { $siteid = get_siteid(); $site_mapping = 'site_mapping_'.$m.'_'.$siteid; if(!$mapping = getcache($site_mapping)){ $data = D('category')->field('catid,`type`,catdir,arrchildid')->where(array('siteid'=>$siteid,'`type`<' => 2))->order('catid ASC')->select(); $mapping = array(); foreach($data as $val){ $mapping['^'.str_replace('/', '\/', $val['catdir']).'$'] = $m.'/index/lists/catid/'.$val['catid']; if($val['type']) continue; $mapping['^'.str_replace('/', '\/', $val['catdir']).'\/list_(\d+)$'] = $m.'/index/lists/catid/'.$val['catid'].'/page/$1'; if(strpos($val['arrchildid'], ',')) continue; $mapping['^'.str_replace('/', '\/', $val['catdir']).'\/(\d+)$'] = $m.'/index/show/catid/'.$val['catid'].'/id/$1'; } //结合自定义URL规则 $route_rules = get_urlrule(); if(!empty($route_rules)) $mapping = array_merge($route_rules, $mapping); setcache($site_mapping, $mapping); } return array_merge($mapping, C('route_rules')); }
set_mapping
上一篇:get_memberavatar
下一篇:get_urlrule
有问题可以加入织梦技术QQ群一起交流学习
本站vip会员 请加入 VIP②群 PS:加入时备注用户名或昵称
普通注册会员或访客 请加入技术交流②群
作者:54818模板网 关注:620 时间:2023-03-17 11:38:37
相关网站教程: