De handleiding»Ontwikkelen met CakePHP»Configuratie»De configuratie klasse»Methoden in Configure»load
{NL} - 3.4.3.1.4 load
load(string $path)
Gebruik deze methode om configuratie informatie te laden uit een specifiek bestand.
// /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');
?>
// /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';?><?phpConfigure::load('messages');Configure::read('Company.name');?>
merk op dat ieder key-value is gerepresenteerd in het bestand met de $config array. Elke andere variabele in dat bestand wordt genegeerd door de load() functie.
{EN} - 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');
?>
// /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';?><?phpConfigure::load('messages');Configure::read('Company.name');?>
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-7 | Lines: 1-7 | ||
| <title>load</title> | <title>load</title> | ||
| <p class="method"><code>load(string $path)</code></p> | <p class="method"><code>load(string $path)</code></p> | ||
| - | <p>Use this method to load configuration information from a specific file.</p> | + | <p>Gebruik deze methode om configuratie informatie te laden uit een specifiek bestand.</p> |
| <pre> | <pre> | ||
| // /app/config/messages.php: | // /app/config/messages.php: | ||
| <?php | <?php | ||
| $config['Company']['name'] = 'Pizza, Inc.'; | $config['Company']['name'] = 'Pizza, Inc.'; | ||
| Lines: 13-17 | Lines: 13-17 | ||
| Configure::load('messages'); | Configure::load('messages'); | ||
| Configure::read('Company.name'); | Configure::read('Company.name'); | ||
| ?> | ?> | ||
| </pre> | </pre> | ||
| - | <p class="note">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> | + | <p class="note">merk op dat ieder <em>key-value</em> is gerepresenteerd in het bestand met de <code>$config</code> array. Elke andere variabele in dat bestand wordt genegeerd door de <code>load()</code> functie.</p> |
