I have defined one variable inside the constants.php
file of codeigniter but i want to know how to use that variable into the view file.
define('UPLOAD_PATH', "/var/www/vhosts/dev/htdocs/p/");
I want to use 'UPLOAD_PATH' variable in my view file but i dont know how to use it.
Global Constant Using Constants.defined('MY_CONSTANT') || define('MY_CONSTANT', 'This is a global constant defined in Constants. php file');
esc($string) ?>" /> If you use any of the form helper functions listed on this page, and you pass values as an associative array, the form values will be automatically escaped, so there is no need to call this function. Use it only if you are creating your own form elements, which you would pass as strings.
The same way you would use a constant in normal php?
echo UPLOAD_PATH; //would produce /var/www/vhosts/dev/htdocs/p/
So in your view file:
<html>
<body>
<?=UPLOAD_PATH?>
</body>
</html>
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