致命错误:未捕获的 ArgumentCountError:函数参数太少(将 php 脚本从 5.4 更改为 7.4)

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

我有问题。请帮助我。我在 php 5.4 中有一个函数,当我使用这个版本时一切正常。我想将我的脚本升级到 php 7.4。在 php 7.4 中我有这个错误。 致命错误:未捕获的 ArgumentCountError:函数 gmolib::load_lang() 的参数太少,

函数文件中的函数

function load_lang($file_lang) {
global $smFunc;

$mlang = $this->gmolang;
if ($smFunc->member['gmo_lang']) {
$dir = @opendir($this->sitepath."langs/lang/");
while (($dirt = readdir($dir)) !== false) {
$gmol = strtolower (substr($dirt, 0, 3));
$bol = strtolower (substr($smFunc->member['gmo_lang'], 0, 3));
if ($gmol == $bol && $dirt != ".htaccess" && $dirt != "htaccess" && $dirt != "index.html" && $dirt != "English_Reference") {
$mlang = $this->sitepath."langs/lang/".$dirt;
}
}
closedir($dir);
}

require "$mlang/$file_lang";
foreach ($langgmo as $k => $v) {
$gmolib->lang[$k] = stripslashes($v);
}
}

语言文件

$langgmo['ptitle1'] = "title1";
$langgmo['ptitle2'] = "title2";
$langgmo['ptitle3'] = "title3";
...

使用页面中的翻译功能

{$gmolib->lang['title1']}

我不知道发生了什么。 php 7.4 中的什么变化导致了这个问题?

php php-7.4 php-5.4
© www.soinside.com 2019 - 2024. All rights reserved.