I have a separate config file for my CakePHP application which is loaded in the bootstrap.php. My question is, how can I access the Configuration's variables in my Controller? I.e. How can I perform the Configure::read('variable') function in Controller? Thanks!
In my custom config file /app/Config/myconfig.php
I define my config variables:
<?php
$config = array(
'variable' => 'myValue'
);
In my Action I read can read the config file and get access of the variables:
Configure::load('myconfig', 'default');
$configValue = Configure::read('variable');
echo $configValue; // myValue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With