函数 mcrypt_get_iv_size() 在运行 PHP 7.1.0 的 MAMP 上的 Laravel 4.2 中已弃用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42023850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:15:25  来源:igfitidea点击:

Function mcrypt_get_iv_size() is deprecated in Laravel 4.2 on MAMP running PHP 7.1.0

phplaravellaravel-4mcryptphp-7.1

提问by Jordan D

I've just upgraded my MAMP server to run 7.1.0. I'm now getting this error with my Laravel 4.2 installations;

我刚刚升级了我的 MAMP 服务器以运行 7.1.0。我现在在安装 Laravel 4.2 时遇到此错误;

Function mcrypt_get_iv_size() is deprecated 

I've tried changing

我试过改变

'cipher' => MCRYPT_RIJNDAEL_128,

to

'cipher' => 'AES-256-CBC',

but to no avail.

但无济于事。

Does anyone know how to get around this issue in Laravel 4.2?

有谁知道如何在 Laravel 4.2 中解决这个问题?

Not a duplicate as explained in the comments.

不是评论中解释的重复。

采纳答案by neoteknic

You should upgrade you laravel project. mcrypt is deprecated in php 7.1.

你应该升级你的 Laravel 项目。mcrypt 在 php 7.1 中已弃用。

You can just disable deprecated warning in your php configuration(or add @ before any mcrypt function), if you don't have time to upgrade.

如果您没有时间升级,您可以在 php 配置中禁用已弃用的警告(或在任何 mcrypt 函数之前添加 @)。

Be carefull ! it will be completly removed in 7.2+

小心点 !它将在 7.2+ 中完全删除

Edit: for php 7.2, it's removed in the core, but you can add mcryt as a pecl extension.

编辑:对于 php 7.2,它已在核心中删除,但您可以添加 mcryt 作为 pecl 扩展。