CodeIgniter - 无法加载请求的类

max*_*ax_ 7 php codeigniter autoload

是的,我想你想要说这个问题可能是重复的,但不是因为类似问题的答案并没有解决我目前遇到的问题.

我在自动加载名为"phpass"的库时收到以下错误,如下所示.

遇到错误无法加载请求的类:Phpass

用于自动加载库的代码

$autoload['libraries'] = array('database', 'phpass');
Run Code Online (Sandbox Code Playgroud)

phpass.php文件驻留在application/libraries文件夹中,并且声明该类class phpass意味着该问题与大写或文件路径无关,正如我遇到的大多数其他答案中所建议的那样.

请你告诉我我错过了什么?它在MAMP中运行良好,但是,当上传到我的Linux Ubuntu服务器(Apache2)时,它停止工作.

谢谢,

最大.

编辑--- Utku请求的构造方法

class phpass {

    protected $PasswordHash;

    // default values if config was not found
    protected $iteration_count_log2 = 8;
    protected $portable_hashes = FALSE;

    /**
     * Construct with configuration array
     * 
     * @param array $config
     */
    public function __construct($config = array()) {
        // check if the original phpass file exists
        if (!file_exists($path = dirname(__FILE__) . '/../vendor/PasswordHash.php')) {
            show_error('The phpass class file was not found.');
        }

        include ($path);

        if (!empty($config)) {
            $this->initialize($config);
        }

        // create phpass object
        $this->PasswordHash = new PasswordHash($this->iteration_count_log2, $this->portable_hashes);
    }
Run Code Online (Sandbox Code Playgroud)

jle*_*eft 29

根据用户指南,我认为文件名和类名的大写是个问题:

  • phppass.php 应该 Phppass.php
  • class phpass 应该 class Phpass