CakePHP: How to add global variables

CakePHP: How to add global variables

How to define a global variable in CakePHP which i can use anywhere in the application.

Solution:
You can write a new config value or you can define a variable or constant in bootstrap.php.

I have done it this way

Declaring Global Variable: Configure::write(‘var_name’,’var_value’);
Reading Global Variable: Configure::read(‘var_name’);

Pin It on Pinterest

Share This