我在CI中收到此错误消息,并且正在使用XAMPP:
遇到错误
加密库需要Mcrypt扩展名。
我已经在寻找其他类似的帖子,但是仍然找不到正确的答案。
我尝试将此操作添加到我的php.ini XAMPP中。
extension = php_mcrypt.dll
第887行。
并重新启动我的xampp。但仍然会出现相同的错误。
谢谢。
答案 0 :(得分:0)
将服务器从PHP 7移到PHP 5 xampp服务器后,它终于可以工作了。
答案 1 :(得分:0)
我收到此错误是因为我已经从XAMPP(php5)切换到XAMPP(php7), 为此,我在这里用新文件encrypt.php替换了旧的CI-> system-> libraries-> 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.');
}
对我有用。