如何从外部 PHP 文件获取变量返回


How to get a variable return from from external PHP file

这是我对这个问题的解释。

我的结构

config.php
modules
--module1
----menu.php
--module2
----menu.php

因此,每个模块都包含一个只返回数组的menu.php文件。

现在从 config.php,我想获取该数组。我该怎么做?

谢谢!

$menu1 = include_once 'modules/module1/menu.php';
$menu2 = include_once 'modules/module2/menu.php';