开发者

Codeigniter global constant

开发者 https://www.devze.com 2023-02-28 18:21 出处:网络
I have defined one variable inside the constants.php file of codeigniter but i want to know how to use th开发者_如何学Pythonat variable into the view file.

I have defined one variable inside the constants.php file of codeigniter but i want to know how to use th开发者_如何学Pythonat 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.


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>


    config file (system/application/config/config.php) to set configuration related variables.

    Or use 

    constant file (system/application/config/constants.php) to store site preference constants.


  =======================
  DEFINE WHAT YOU WANT
  =======================
  $config['index_page'] = 'home';
  $config['BASEPATH'] = 'PATH TO YOUR HOST';
0

精彩评论

暂无评论...
验证码 换一张
取 消