php - 如何在两个函数之间进行数组合并?
问题描述
我想得到一个,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;
}
解决方案
推荐阅读
- node.js - 我如何在阿多尼斯中使用 whereHas ?
- android - Android - 如何获取每个应用程序的使用/屏幕时间?
- wordpress - 如何根据表单输入更改文本?(立即显示价格)
- sql - 在python中加速SQL到字典
- smalltalk - Smalltalk 类的生命周期是什么?
- css - 什么是“块内容”CSS 样式?
- c# - 右键单击数据网格以显示上下文菜单 wpf
- powershell - 获取大邮箱,按大小和 AD 状态排序
- opengl-es - 在 OpenGL ES 中缓存三角函数有意义吗?
- python - 你如何让'While False'循环在python中工作?