自动加载
CI中怎么才能每个方法中都include着config.inc.php呢? 自己写个类库文件,在这个文件里include那个文件,然后autoload吧 楼上说的对,ci 没这个功能,需要自己想办法。 昨晚上 想了半天,还是没有弄明白,继续吧 写个 helper,然后在 helper 里 include 这个文件,然后在 autoload 中加入这个 helper。 OK 没问题 函数<?php
function includeuc()
{
echo "function includeuc";
include 'assets/config.inc.php';
}
?>
自动加载
$autoload['helper'] = array('includeuc');
那里没有对?为什么不行? 是不是 有些要注意的东西 我没有注意到!? 看这个 http://codeigniter.org.cn/user_guide/general/helpers.html
你只是缺乏细心,呵呵
页:
[1]