How to define a global variable(value) in codeIgniter

前端 未结 4 956
悲&欢浪女
悲&欢浪女 2021-01-22 02:58

I simply do not mean how to define a global variable/constant in CodeIgniter. Let me explain: I have made a theme engine which is select-able from the current logged in user\'s

4条回答
  •  星月不相逢
    2021-01-22 03:37

    I got this from the manual and this what I have at the top of my config/config.php file: (i have a custom config set to paypal testing)

    // HOW TO USE - For example if there's $config['foo'] = 'bar';
    // in the config 
    // using $this- >config->item('foo') will be 'bar'.
    
    // example for my paypal testing: 
    $config['paypaltest']=0;  
    

    http://ellislab.com/codeigniter%20/user-guide/libraries/config.html

    and how to access in a controller:

    $paypaltest = $this->config->item('paypaltest');
    

提交回复
热议问题