|
我想把$this->config->base_url();缩短点儿,因为使用频率很高
我自定义了一个类
PHP复制代码 <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Myclass {
public function __construct ()
{
$CI =& get_instance ();
$_root = $CI->config->base_url();
}
} 复制代码
然后在autoload里加上$autoload['libraries'] = array('myclass');
但在页面上echo $_root;
提示Undefined variable: _root
|
|