解析CodeIgniter自定义配置文件
时间:2021-05-20 09:29:09|栏目:PHP代码|点击: 次
我们有时候在CI框架中需要自定义配置文件,那要怎么处理呢?下面就给你介绍处理的办法。
配置文件config/expert.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* 专家配置文件
*
* @author xxx
* @version $Id: expert.php v 1.0 2012/5/31 14:41:00 xxx $
* @package ask.xxx.com
* @copyright 1997-2012 www.xxx.com
*/
// 专家ID
$config['expertid'] = array('0' => '124', '1' => '81', '2' => '136');
?>
获取配置数据示例
$this->config->load('expert', TRUE);
$expertid = $this->config->item('expertid', 'expert');
配置文件config/expert.php
复制代码 代码如下:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* 专家配置文件
*
* @author xxx
* @version $Id: expert.php v 1.0 2012/5/31 14:41:00 xxx $
* @package ask.xxx.com
* @copyright 1997-2012 www.xxx.com
*/
// 专家ID
$config['expertid'] = array('0' => '124', '1' => '81', '2' => '136');
?>
获取配置数据示例
$this->config->load('expert', TRUE);
$expertid = $this->config->item('expertid', 'expert');
上一篇:使用PHP编写发红包程序
栏 目:PHP代码
下一篇:ThinkPHP3.2框架使用addAll()批量插入数据的方法
本文标题:解析CodeIgniter自定义配置文件
本文地址:http://www.codeinn.net/misctech/125157.html






