【问题标题】:The Encrypt library requires the Mcrypt extension errorEncrypt 库需要 Mcrypt 扩展错误
【发布时间】:2019-01-19 17:45:03
【问题描述】:

我在 CI 中收到此错误消息,我正在使用 XAMPP:

遇到错误

加密库需要 Mcrypt 扩展。

我已经在寻找其他类似的帖子,但仍然没有找到正确的答案。

我尝试在我的 php.ini XAMPP 中添加这个脚本:

extension=php_mcrypt.dll

第 887 行。

然后重新启动我的 xampp。但仍然出现同样的错误。

谢谢。

【问题讨论】:

标签: xampp


【解决方案1】:

在我将服务器从 PHP 7 移动到 PHP 5 xampp 服务器后,它终于可以工作了。

【讨论】:

    【解决方案2】:

    我收到此错误是因为我已从 XAMPP(php5) 切换到 XAMPP(php7), 为此,我在这里用新文件替换了旧的 CI->system->libraries->encrypt.php:encrypt.php,它起作用了。

    在这个新文件中,我们使用下面的代码检查 __construct 函数中是否支持 mcrypt_encrypt

       $this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
    

    基于此,我们在 mcrypt_encode 和 _xor_encode 之间使用不同的函数。

    要知道,如果你在 __construct 函数中看到这个旧文件,你会看到实际的错误检查

        if (($this->_mcrypt_exists = function_exists('mcrypt_encrypt')) === FALSE)
        {
            show_error('The Encrypt library requires the Mcrypt extension.');
        }
    

    它对我有用。

    【讨论】:

      猜你喜欢
      • 2018-11-05
      • 2019-02-27
      • 2016-06-18
      • 2014-09-26
      • 2017-05-11
      • 2014-06-29
      相关资源
      最近更新 更多