ZF读取配置文件

| | 评论(0)

1.加载配置文件:
require_once 'Zend/Config/Ini.php';
$config['nestSeparator'] = ':';
$config = new Zend_Config_Ini('/path/to/config.ini', 'staging', $config);

另一种加载文件的方法
Zend_Loader::loadClass('AppController','../application/controllers'); //加载基本控制器
// 加载配置
$config= new Zend_Config_Ini('../application/config.ini', 'reader');

2.config.ini文件示例
[general]
db.adapter = PDO_Oci
db.config.username = cat
db.config.password = dog
db.config.dbname = rabbit

[reader]
reader.LIB_CODE_REDRSTS_CANCEL = 0
reader.LIB_CODE_REDRSTS_ENABLE = 1
reader.LIB_CODE_CERTSTS_CANCEL = 0

3.读取配置文件

$redr=$config->reader->redr_lose;

参考资料:http://www.phpeye.com/zf/zend.config.adapters.ini.html

分类

发表评论


键入您在以上图片中看到的字符。

关于此日记

此日记由ringtail发表于2007年10月23日 上午09时42分

此Blog上的上一篇日记小猫近照

此Blog上的下一篇日记《暗恋桃花源》

主索引归档页可以看到最新的日记和所有日记。

Powered by Movable Type 4.01