解析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解答方法

题目:组合算法:有一个数组a,有N 个元素,现在要求从中找出含有任意元素的所有组合个数。 解答:先看规律吧: 假设这个数组为array(1,2,3,4,5)那么M=5; 可能出现的组合为...

用PHP获取Google AJAX Search API 数据的代码

http://code.google.com/apis/ajaxsearch/documentation/ 复制代码 代码如下: // This example request incl...

CodeIgniter基本配置详细介绍

$config['base_url'] = "//www.jb51.net/"。 您网站的网址,CodeIgniter 会根据这个网址来生成链接、表单地址等。$config['index...

php 批量替换html标签的实例代码

1.把html元素全部去掉,或者保留某几个html标签复制代码 代码如下:<?php$text = '<p>Test paragraph.</p><!...

php set_time_limit()函数的使用详解

语法 : void set_time_limit (int seconds)说明 : 设定一个程式所允许执行的秒数,如果到达限制的时间,程式将会传回错误。它预设的限制时间是30秒,max...