如何从 PHP 文件加载返回数组? - How to load return array from a PHP file?

问题:

I have a PHP file a configuration file coming from a Yii message translation file which contains this:我有一个 PHP 文件,一个来自Yii消息翻译文件的配置文件,其中包含以下内容:

<?php
 return array(
  'key' => 'value'
  'key2' => 'value'
 );
?>

I want to load this array from another file and store it in a variable我想从另一个文件加载这个数组并将其存储在一个变量中

I tried to do this but it doesn't work我试图这样做,但它不起作用

function fetchArray($in)
{
   include("$in");
}

$in is the filename of the PHP file $in是 PHP 文件的文件名

Any thoughts how to do this?任何想法如何做到这一点?


解决方案:

参考: https://stackoom.com/en/question/TgBU
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章