首页 > 解决方案 > 如何在两个函数之间进行数组合并?

问题描述

我想得到一个,array_merge但我做不到。调用 example.php 文件还必须嵌入Usage_Module函数的数组。

注意:不得getFunctionModule更改功能。

当然我在Usage_Module函数中错了,你能帮我理解我错了吗?

代码示例.php

function getFunctionModule() {

require "module.php";
$func = "Usage_Module";
            if (!function_exists($func)) {
                        echo "function not found";
            }
return (array) $func();
}

$data = ['status' => 'ok'];
$data = array_merge(getFunctionModule(), $data);
print_r($data);

代码模块.php

function Usage_Module()
    {
        $data = ['licensekey2' => 'ok'];
        return (array) $data;
    }

标签: php

解决方案


推荐阅读