我已經爲登錄驗證創建了一個自定義庫文件。如果我在$ 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 .. –