Class CConfiguration
CConfiguration represents an array-based configuration.
It can be used to initialize an object's properties.
The configuration data may be obtained from a PHP script. For example,
return array( 'name'=>'My Application', 'defaultController'=>'index', );
Use the following code to load the above configuration data:
$config=new CConfiguration('path/to/config.php');
To apply the configuration to an object, call CConfiguration::applyTo()
. Each
(key,value) pair in the configuration data is applied to the object like:
$object->$key=$value.
Since CConfiguration extends from CMap
, it can be used like an
associative array. See CMap
for more details.
- CComponent
- CMap implements IteratorAggregate, ArrayAccess, Countable
- CConfiguration
Package: system\collections
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/collections/CConfiguration.php
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/collections/CConfiguration.php
public
|
|
public
|
#
loadFromFile( string $configFile )
Loads configuration data from a file and merges it with the existing configuration. |
public
string
|
#
saveAsString( )
Saves the configuration into a string. The string is a valid PHP expression representing the configuration data as an array. |
public
|
add(),
clear(),
contains(),
copyFrom(),
count(),
getCount(),
getIterator(),
getKeys(),
getReadOnly(),
itemAt(),
mergeArray(),
mergeWith(),
offsetExists(),
offsetGet(),
offsetSet(),
offsetUnset(),
remove(),
setReadOnly(),
toArray()
|
$count,
$iterator,
$keys,
$readOnly
|