我已经为登录验证创建了一个自定义库文件。如果我在$ this-> load-> library('form_validation')之前调用自定义库,在codeigniter中使用外部库类
class VerifyLogin extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->model('loginuser');
$this->load->library('validate_login','','session_validation');// where validate_login is the custom library class inside applications/libraries/validate_login.php
}
function index()
{
//my code
$this->load->library('form_validation');
}
}
这是我得到$ this-> load-> library('form_validation')的错误;它适用于perfectley。 我只想知道为什么这段代码有效?我是否覆盖默认库?
消息:未定义的属性:VerifyLogin :: $ form_validation
,如果我加载库后
class VerifyLogin extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->model('loginuser');
$this->load->library('form_validation');
$this->load->library('validate_login','','session_validation');// where validate_login is the custom library class inside applications/libraries/validate_login.php
}
function index()
{
//my code
}
}
发布你的'Validate_login'。 – Sobiaholic
@Sobiaholic我在答案中加入了validate_login .. –