PHP 7.3 PHP 已弃用:函数 create_function() 已弃用

问题描述 投票:0回答:2

我将我的 php 版本从 5.6 更新到 7.3,现在显示错误 PHP 已弃用:函数 create_function() 在 magiczoomplus/magiczoomplus.module.core.class.php 第 78 行已弃用

我的代码如下

'restore-speed' => create_function('&$params', 'return $params->checkValue("restore-speed","-1")?$params->getValue("expand-speed"):$params->getValue("restore-speed");')));

如何为 PHP 7.3 重写上面的代码?

php anonymous-function prestashop-1.6 php-7.3
2个回答
0
投票
'restore_speed' => function ($params) {
    return $params->checkValue("restore-speed", "-1") ? $params->getValue("expand-speed") : $params->getValue("restore-speed");
},

可能是这样的:)


0
投票

我不是100%确定你在PHP中使用的代码方法,但是mysql代码已经被mysqli替换了

根据这个你应该把它放在一个变量中

$this->code=create_function(/*some code*/); 

我使用 mysqli_query 并且仍在更改旧文件的代码。 希望这能让您走上正确的道路。

© www.soinside.com 2019 - 2024. All rights reserved.