Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at docs.zendframework.com
Zend_Config_Json - Zend_Config
The following is a JSON version of a standard application configuration.
To utilize it, you simply instantiate Zend_Config_Json, pointing it to the location of this file and indicating the section of the file to load. By default, constant names found in values will be substituted with their appropriate values.
Once instantiated, you use it as you would any other configuration object.
JSON has a strict structure with regards to data types. As such, you need to ensure that your constants are use correctly. For constants that have string values, put your constant values in double quotes (""). For non-string values, you can omit the quotes -- but be absolutely certain that they are not returning strings, as otherwise you will encounter parser errors with your configuration file. When in doubt, enclose the contant in double quotes.
The following options may be passed as keys to the third, $options argument of the constructor.
The default behavior of Zend_Config is to mark the object as immutable once loaded. Passing this flag with a boolean true will enable modifications to the object.
By default, any time a section extends another, Zend_Config will merge the section with the section it extends. Speciying a boolean true value to this option will disable this feature, giving you only the configuration defined explicitly in that section.
By default, Zend_Config_Json will replace constant names found in values with the defined constant value. You map pass a boolean true to this option to disable this functionality.
Please note that ignoring constants can potentially lead to parse errors, particularly if you are using constants for integer, float, or boolean values. The safest practice is to enclose constants within quotes.
Constructor. $json should be either a valid JSON string, or refer to a valid filesystem location containing a JSON configuration file. $section, if specified, indicates a specific section of the configuration file to use. $options is discussed in the options section.
This static function may be used to globally override the default settings for how constants found in JSON strings are handled. By default, constant names are replaced with the appropriate constant values; passing a boolean true value to this method will override that behavior. (You can override it per-instance via the ignore_constants option as well.)
This static method gives you the current setting for the ignore_constants flag.