php - zend framework 2 constants -
i have declare constants available anywhere in application. in zend framework 1 used declare in application.ini
:
constants.name_title = "user name",
where , how in zend framework 2 ?
i have found solution here. have create storage class in model. in class can create many constants want.
<?php namespace application\model; class application { const email = 'email@gmail.com'; }
now can accessed everywhere by:
nameofmodule\model\nameofmodel::nameofconstant
so can example print constant in view this:
<?php echo application\model\application::email; ?>
Comments
Post a Comment