标签:
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);
标签:
原文地址:http://www.cnblogs.com/leedanings/p/4274262.html