我正在使用此代码在我的 CMS 中获取模块信息:
global $hook;
$hook = new bn_hookfunc;
ob_start();
include_once($mydir);
ob_end_clean();
$mod_name = $hook->call_function('module_name');
$mod_ver = $hook->call_function('module_version');
我的模块 config.php 看起来像这样:
global $hook;
$hook->module_name='modname';
$hook->module_version='modver';
function modname()
{
return 'test module';
}
function modver()
{
return 'v1.0.0';
}
此代码在 PHP 5.4 中完美运行。
但是我将我的 xampp 更新为 1.83,因此 PHP 更新为 5.5.3,现在我有这个错误:
Cannot redeclare modname() (previously declared in \modules\example\config.php:13) in \modules\Z48ilWd2l80cYed8\config.php on line 14
我怎么解决这个问题?