Config_Container::createSection()

Config_Container::createSection() -- 向条目中添加节

大纲

require_once 'Config/Container.php';

对象 Config_Container::createSection (字符串 $name [, 数组 $attributes = NULL [, 字符串 $where = 'bottom' [, 对象 $target = NULL]]])

基本描述

必须在一个已存在的节中使用。它是 createItem() 函数的一个辅助方法。

参数

字符串 $name

新节的名称

数组 数组 $attributes

新节的属性

字符串 $where

创建的位置(一般为'top', 'bottom', 'before', 'after')。

对象 $target

仅当$where参数使用'before'或'after'时使用。

返回值

对象 - 新条目的类型。

Throws

表 24-1. 可能出现的 PEAR_Error 值

Error codeError valueMeaningSolution
 ""  

注意

该函数不能被静态调用。

例子

例子 24-1. Create a new section using createSection()

$conf =& new Config_Container('section', 'MAIN');
$dbConf =& $conf->createSection('DB');
$dbConf->createDirective('user', 'mansion');