php – CodeIgniter – 无法加载请求的类

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

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

An Error Was Encountered
Unable to load the requested class: PHPass

用于自动加载库的代码

$autoload['libraries'] = array('database','PHPass');

PHPass.PHP文件驻留在application / libraries文件夹中,并且该类被声明为类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);
    }
根据 user guide,我认为你的文件名和类名的大写是个问题:

> PHPpass.PHP应该是PHPpass.PHP>课程PHPass应该是PHPass类

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...