Loads the section $section from the config file $filename for access facilitated by nested object properties.
If the section name contains a ":" then the section name to the right is loaded and included into the properties. Note that the keys in this $section will override any keys of the same name in the sections that have been included via ":".
If the $section is null, then all sections in the ini file are loaded.
If any key includes a ".", then this will act as a separator to create a sub-property.
example ini file: [all] db.connection = database hostname = live
[staging : all] hostname = staging
after calling $data = new Zend_Config_Ini($file, 'staging'); then $data->hostname === "staging" $data->db->connection === "database"
The $options parameter may be provided as either a boolean or an array. If provided as a boolean, this sets the $allowModifications option of Zend_Config. If provided as an array, there are three configuration directives that may be set. For example:
$options = array( 'allowModifications' => false, 'nestSeparator' => ':', 'skipExtends' => false, );
- Parameters
-
string | $filename | |
mixed | $section | |
boolean | array | $options | |
- Exceptions
-
- Returns
- void
- See also
- Zend_Config_Exception
-
Zend_Config_Exception
Definition at line 101 of file Ini.php.
103 if (empty($filename)) {
107 #require_once 'Zend/Config/Exception.php'; 111 $allowModifications =
false;
115 if (isset(
$options[
'allowModifications'])) {
116 $allowModifications = (bool)
$options[
'allowModifications'];
118 if (isset(
$options[
'nestSeparator'])) {
119 $this->_nestSeparator = (string)
$options[
'nestSeparator'];
121 if (isset(
$options[
'skipExtends'])) {
122 $this->_skipExtends = (bool)
$options[
'skipExtends'];
128 if (
null === $section) {
130 $dataArray = array();
131 foreach ($iniArray as $sectionName => $sectionData) {
132 if(!is_array($sectionData)) {
135 $dataArray[$sectionName] = $this->
_processSection($iniArray, $sectionName);
138 parent::__construct($dataArray, $allowModifications);
141 if (!is_array($section)) {
142 $section = array($section);
144 $dataArray = array();
145 foreach ($section as $sectionName) {
146 if (!isset($iniArray[$sectionName])) {
150 #require_once 'Zend/Config/Exception.php'; 156 parent::__construct($dataArray, $allowModifications);
159 $this->_loadedSection = $section;
elseif(isset( $params[ 'redirect_parent']))
_processSection($iniArray, $section, $config=array())
_processKey($config, $key, $value)
_arrayMergeRecursive($firstArray, $secondArray)