The Cookbook»1.2 Collection»The Manual»Developing with CakePHP»Configuration»The Configuration Class»Configure Methods»read
{1377} - 3.4.3.1.2 read
read(string $key = 'debug')
read(string $key = 'debug')
Used to read configuration data from the application. Defaults to CakePHP’s important debug value. If a key is supplied, the data is returned. Using our examples from write() above, we can read that data back:
Configure::read('Company.name'); //yields: 'Pizza, Inc.'
Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul'
Configure::read('Company');
//yields:
array('name' => 'Pizza, Inc.', 'slogan' => 'Pizza for your body and soul');
Configure::read('Company.name'); //yields: 'Pizza, Inc.'Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul'Configure::read('Company');//yields:array('name' => 'Pizza, Inc.', 'slogan' => 'Pizza for your body and soul');
{3887} - 3.4.3.1.2 read
read(string $key = 'debug')
Used to read configuration data from the application. Defaults to CakePHP’s important debug value. If a key is supplied, the data is returned. Using our examples from write() above, we can read that data back:
Configure::read('Company.name'); //yields: 'Pizza, Inc.'
Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul'
Configure::read('Company');
//yields:
array('name' => 'Pizza, Inc.', 'slogan' => 'Pizza for your body and soul');
Configure::read('Company.name'); //yields: 'Pizza, Inc.'Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul'Configure::read('Company');//yields:array('name' => 'Pizza, Inc.', 'slogan' => 'Pizza for your body and soul');
Differences
| Lines: 1-12 | Lines: 1-12 | ||
| <title>read</title> | <title>read</title> | ||
| - | <pre>read(string $key = 'debug')</pre> | + | <p class="method"><code>read(string $key = 'debug')</code></p> |
| <p>Used to read configuration data from the application. Defaults to CakePHP’s important debug value. If a key is supplied, the data is returned. Using our examples from write() above, we can read that data back:</p> | <p>Used to read configuration data from the application. Defaults to CakePHP’s important debug value. If a key is supplied, the data is returned. Using our examples from write() above, we can read that data back:</p> | ||
| <pre> | <pre> | ||
| Configure::read('Company.name'); //yields: 'Pizza, Inc.' | Configure::read('Company.name'); //yields: 'Pizza, Inc.' | ||
| Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul' | Configure::read('Company.slogan'); //yields: 'Pizza for your body and soul' | ||
| Configure::read('Company'); | Configure::read('Company'); | ||
| //yields: | //yields: | ||
| - | array('name' => 'Pizza, Inc.', 'slogan' => 'Pizza for your body and soul'); | + | array('name' =&gt; 'Pizza, Inc.', 'slogan' =&gt; 'Pizza for your body and soul'); |
| </pre> | </pre> | ||
