我创建了一个生成数组的脚本。需要存储此数组,以便如果用户想要导出其内容(例如 print ),它可能是可能的。
这是我的数组 ($doc)
Array
(
[0] => Array
(
[0] => ------
[1] => ---Start----
[2] => -------
[3] => Generated on Saturday, 3rd, August 2013
)
[1] => Array
(
[0] => ------
[1] => -------
[2] => -------
[3] => -----------------------
)
[2] => Array
(
[0] => Tid
[1] => Policy
[2] => Budget
[3] => User
[4] => Capturetime
[5] => Country
)
[3] => Array
(
[0] => 1
[1] => ask
[2] => das
[3] => carol
[4] => 2013-07-09
[5] => Ethiopia
)
[4] => Array
(
[0] => 2
[1] => das
[2] => adsasd
[3] => ck
[4] => 2007-07-13
[5] => Slovakia
)
[5] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
)
[6] => Array
(
[0] => ------
[1] => ---End----
[2] => -------
)
)
现在我将数组保存到一个文件中:
file_put_contents('array.txt', print_r($printdoc, true));
然后我想将 array.txt 的内容回调到数组 $printdoc 并将其用作数组。
$printdoc = file_get_contents('array.txt', true);
我得到 $printdoc 作为字符串而不是数组
任何帮助?