object Config_Container::addItem (
object &$item
, string $where = 'bottom'
, object $target
= = null
)
このメソッドは現在の子コンテナに子Config_Containerを加えるでしょう。
したがって、addItem()
は単に1つのセクションタイプコンテナと呼ぶことができます。
位置が指定されれば、
オブジェクトはこの位置で加えられるでしょう。
もし'before'
か'after'
が位置として指定された場合、ターゲットオブジェクトが必要です。
are specified as position, a target object is required.
その後、オブジェクトは、
現在のコンテナ中のターゲットオブジェクトの位置の前、
あるいはその位置の後に加えられるでしょう。
&$item
コンテナオブジェクトです。
$where
一の選択です。('bottom'
,
'top'
, 'after'
,
'before'
)
$target
もし$where
で、
'before'
か'after'
を選択した場合に必要です。
$target
は、
このコンテナの子供のうちのひとつである必要があります。
ZendEngine2は、デフォルトでリファレンスを受け取ります。
その後、
&$target
を代わりに持つことは可能でしょう。
object
-
追加されたオブジェクトのリファレンスです。
エラーコード | エラー値 | 意味 | 解決 |
---|---|---|---|
" |
This function can not be called statically.
addItem()でアイテムを追加する使用例
<?php
$section =& new Config_Container('section', 'conf');
$directive =& new Config_Container('directive', 'user', 'mansion');
$section->addItem($directive);
?>
別のアイテムに関連する位置とaddItem()でアイテムを追加する使用例
<?php
$section =& new Config_Container('section', 'conf');
$directive =& new Config_Container('directive', 'user', 'mansion');
$section->addItem($directive);
$comment =& new Config_Container('comment', null, 'Here goes my name');
$section->addItem($comment, 'before', $directive);
?>