用php8的其他东西替换create_function()
因此,我有一个以前工作正常的插件,但是几天后,它给我带来了一个错误:
php致命错误:未定的错误:致电未定义的函数create_function()
后,我发现这是因为create_function()
搜索 问题是:
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
我尝试将其更改为:
$callback_2 = function(){
('$matches', return "[" . str_replace("|", "", $matches[1]) . "]";);
}
但是它不起作用。因此,如果有人可以将我指向正确的方向,我也是PHP的新手,那就太好了。
So I have a plugin that was working fine previously, but for a few days now it is throwing me an error as:
PHP Fatal error: Uncaught Error: Call to undefined function create_function()
After a bit of searching, I found out that this is because create_function()
is deprecated in PHP 8.
Now the exact line that causes the issue is this:
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
I tried changing this to:
$callback_2 = function(){
('$matches', return "[" . str_replace("|", "", $matches[1]) . "]";);
}
But it's not working. So it would be great if someone could point me in the right direction also I am very new to PHP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
Try