{1648} - 3.4.3.1.4 load

load(string $path)
  1. load(string $path)

Use this method to load configuration information from a specific file.

// /app/config/messages.php:
<?php
$config['Company']['name'] = 'Pizza, Inc.';
$config['Company']['slogan'] = 'Pizza for your body and soul';
$config['Company']['phone'] = '555-55-55';
?>
 
<?php
Configure::load('messages');
Configure::read('Company.name');
?>
  1. // /app/config/messages.php:
  2. <?php
  3. $config['Company']['name'] = 'Pizza, Inc.';
  4. $config['Company']['slogan'] = 'Pizza for your body and soul';
  5. $config['Company']['phone'] = '555-55-55';
  6. ?>
  7. <?php
  8. Configure::load('messages');
  9. Configure::read('Company.name');
  10. ?>

Note that every configure key-value pair is represented in the file with the $config array. Any other variables in the file will be ignored by the load() function.

{4254} - 3.4.3.1.4 load

load(string $path)

Use this method to load configuration information from a specific file.

// /app/config/messages.php:
<?php
$config['Company']['name'] = 'Pizza, Inc.';
$config['Company']['slogan'] = 'Pizza for your body and soul';
$config['Company']['phone'] = '555-55-55';
?>
 
<?php
Configure::load('messages');
Configure::read('Company.name');
?>
  1. // /app/config/messages.php:
  2. <?php
  3. $config['Company']['name'] = 'Pizza, Inc.';
  4. $config['Company']['slogan'] = 'Pizza for your body and soul';
  5. $config['Company']['phone'] = '555-55-55';
  6. ?>
  7. <?php
  8. Configure::load('messages');
  9. Configure::read('Company.name');
  10. ?>

Every configure key-value pair is represented in the file with the $config array. Any other variables in the file will be ignored by the load() function.

Differences

Lines: 1-6Lines: 1-6
 <title>load</title> <title>load</title>
-<pre>load(string $path)</pre> +<p class="method"><code>load(string $path)</code></p>
 <p>Use this method to load configuration information from a specific file.</p> <p>Use this method to load configuration information from a specific file.</p>
 <pre> <pre>
 // /app/config/messages.php: // /app/config/messages.php:
 &lt;?php &lt;?php
Lines: 13-17Lines: 13-17
 Configure::load('messages'); Configure::load('messages');
 Configure::read('Company.name'); Configure::read('Company.name');
 ?&gt; ?&gt;
 </pre> </pre>
-<p&gt;Note that every configure key-value pair is represented in the file with the $config array. Any other variables in the file will be ignored by the load() function.</p> +<p class=&quot;note&quot;&gt;Every configure key-value pair is represented in the file with the <code>$config</code> array. Any other variables in the file will be ignored by the <code>load()</code> function.</p>