码迷,mamicode.com
首页 > 编程语言 > 详细

CI获取自定义配置文件中的二维配置数组

时间:2015-02-05 13:12:37      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

CI获取自定义配置文件中的二维配置数组:
如:
在admin.php配置文件中有如下配置:
$config[‘admin_menu‘][] = array(
‘name‘ => ‘商品管理‘,
‘c‘ => ‘goods‘,
‘a‘ => ‘lists‘,
‘icon‘=>‘ icon-gift‘,
‘item‘ => array(
//商品
0 => array(‘name‘ => ‘商品列表‘, ‘c‘ => ‘goods‘, ‘a‘ => ‘lists‘, ‘display‘ => 1,‘icon‘=>‘‘),
7 => array(‘name‘ => ‘商品查询‘, ‘c‘ => ‘goods‘, ‘a‘ => ‘goods_search‘, ‘display‘ => 0,‘icon‘=>‘‘),
1 => array(‘name‘ => ‘商品添加‘, ‘c‘ => ‘goods‘, ‘a‘ => ‘add‘, ‘display‘ => 0,‘icon‘=>‘‘),
2 => array(‘name‘ => ‘商品编辑‘, ‘c‘ => ‘goods‘, ‘a‘ => ‘edit‘, ‘display‘ => 0,‘icon‘=>‘‘),

)
);

$config[‘admin_menu‘][] = array(
‘name‘ => ‘商品分类‘,
‘c‘ => ‘goods_category‘,
‘a‘ => ‘lists‘,
‘icon‘=>‘ icon-group‘,
‘item‘ => array(
//分类
3 => array(‘name‘ => ‘商品分类‘, ‘c‘ => ‘goods_category‘, ‘a‘ => ‘lists‘, ‘display‘ => 1,‘icon‘=>‘‘),
4 => array(‘name‘ => ‘添加分类‘, ‘c‘ => ‘goods_category‘, ‘a‘ => ‘add‘, ‘display‘ => 0,‘icon‘=>‘‘),
8 => array(‘name‘ => ‘编辑分类‘, ‘c‘ => ‘goods_category‘, ‘a‘ => ‘edit‘, ‘display‘ => 0,‘icon‘=>‘‘),

)
);

在view文件中调用该配置文件中的内容:
/*$CI = &get_instance();
$CI->load->config(‘admin‘);
$admin_menu = config_item(‘admin_menu‘);*/
$this->config->load(‘admin‘, TRUE);
$admin_menu = $expertid = $this->config->item(‘admin_menu‘, ‘admin‘);
echo "<BR>aname:".print_r($admin_menu);

CI获取自定义配置文件中的二维配置数组

标签:

原文地址:http://www.cnblogs.com/leedanings/p/4274262.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!