Php Can';找不到文件
在处理了一些文件并试图弄明白这一点后,我确实在某个地方遇到了问题。它说它无法找到指定的模型,这是我的登录尝试。我正在用坦克库来模拟我自己的东西。有一些想法,我正在使用我的编码它,以满足我自己的需要 库/Kow_auth.phpPhp Can';找不到文件,php,codeigniter,Php,Codeigniter,在处理了一些文件并试图弄明白这一点后,我确实在某个地方遇到了问题。它说它无法找到指定的模型,这是我的登录尝试。我正在用坦克库来模拟我自己的东西。有一些想法,我正在使用我的编码它,以满足我自己的需要 库/Kow_auth.php <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /** * KOW Auth Library * Authentication Library for Code Ig
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* KOW Auth Library
* Authentication Library for Code Igniter
* @author Jeffrey Davidson
* @version 1.0.0
* @copyright 2012
*/
class Kow_auth
{
protected $CI;
function __construct()
{
//assign the CI superglobal to $CI
$this->CI =& get_instance();
}
function is_max_login_attempts_exceeded($user_id)
{
$this->CI->load->model('kow_auth/login_attempts');
return $this->CI->login_attempts->get_attempts_num($user_id) >= 5;
}
}
?>
模型/知识验证/登录尝试
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Login_attempts
*
* This model serves to watch on all attempts to login on the site
* (to protect the site from brute-force attack to user database)
*
* @package Kow_auth
* @author Jeffrey Davidson
*/
class Login_attempts extends CI_Model
{
function __construct()
{
parent::__construct();
}
function get_attempts_num($user_id)
{
$this->db->select('failed_attempts');
$this->db->where('user_id', $user_id);
$query = $this->db->get('users_logins');
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row->failed_attempts;
}
else
{
return false;
}
}
}
代码看起来不错。我唯一想说的就是注意名字。根据您的代码,您的模型应位于文件中:
models/kow_auth/login_attempts.php
使用小写文件夹名称。代码看起来正确。我唯一想说的就是注意名字。根据您的代码,您的模型应位于文件中:
models/kow_auth/login_attempts.php
使用小写的文件夹名称