开发者

Codeigniter global constant

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜