在 php 文件中存储一个大数组


Store a large array in a php file

我有一个大的"配置"数组,我想将其存储在不同的文件中(从Laravel的配置文件中获取这种做法)。

存放在app/config/myconfig.php

<?php
return array(
  'foo' => 'bar',
);

如果我想分配它,我将如何在代码中调用它? 例如 $myarray = app/config/myconfig.php

包含文件:

    $myarray = include 'app/config/myconfig.php';