解析CodeIgniter自定义配置文件

yipeiwu_com5年前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');

相关文章

PHP实现动态创建XML文档的方法

PHP实现动态创建XML文档的方法

本文实例讲述了PHP实现动态创建XML文档的方法。分享给大家供大家参考,具体如下: 一. 代码 conn.php <?php $id=mysql_connect("lo...

php将12小时制转换成24小时制的方法

本文实例讲述了php将12小时制转换成24小时制的方法。分享给大家供大家参考。具体如下: php将12小时制转换成24小时制,输入格式为:02:30:00 pm 转换成:14:30:00...

php 删除无限级目录与文件代码共享

<? //删除目录 class del_path { function wm_chief_delpath($del_path) { if(!file_exists($del_pat...

php基于jquery的ajax技术传递json数据简单实例

本文实例讲述了php基于jquery的ajax技术传递json数据简单实现方法。分享给大家供大家参考,具体如下: html页面: <html> <head>...

php 显示指定路径下的图片

复制代码 代码如下:function getAllDirAndFile($path) { if(is_file($path)) { if(isImage($path)) { $str="...