php中的新功能我有一个脚本可以打印出一个数组。 结果如下:
Array ( [0] => Array ( [timestamp] => 1390242176
[length] => 32
[devtoken] => 21440e995d08db7c8a561afeabcb6c4fed4b37d0e1d695065d8143ebc7a4da7b )
[1] => Array ( [timestamp] => 1390241961
[length] => 32
[devtoken] => 29da231c1476beefbb947a48b8d63d5aab3daaf246e431cdf55d191aa0d732b8 )
[2] => Array ( [timestamp] => 1390242596
[length] => 32
[devtoken] => 33f9140027b0387c40debc6bf39dd407846c6be98fb232905c6a1cf920cfc644 )
[3] => Array ( [timestamp] => 1390242333
[length] => 32
[devtoken] => 734d0e413f59f84b37452e98627263abd5db714d1c11fa59997c6ff1ded487c9 )
[4] => Array ( [timestamp] => 1390241668
[length] => 32
[devtoken] => 89f7ffcbc46e6e0b9fb84e5d79b6b7d9e9895706dd70e4dd4774d5a5399b81b2 )
[5] => Array ( [timestamp] => 1390242685
[length] => 32
[devtoken] => 91eb6fb37d94af40eee5dfeb99933cd546d1bc9ee32d4ca048286ccc33ec2f4c )
[6] => Array ( [timestamp] => 1390242799
[length] => 32
[devtoken] => a5b04a2d04cdda4ceca1229d2fcf59c839326badc4f63f64e63d7940df72d447 )
[7] => Array ( [timestamp] => 1390241504
[length] => 32
[devtoken] => af0e938a785276459fcf9691b96aff2f63526d49ec959bf25c9de9d0d8d78c2a )
)
我没有把这个数组写入文件。 我想要做的是将其粘贴到我的php文件中,并从这个文本中创建一个简单的数组。 我怎样才能做到这一点 ? 谢谢你的帮助。
答案 0 :(得分:0)
您可以使用serialize功能输出数据。 您可以使用该输出并将其放在unserialize函数中:
$myArray = array (
'key' => 'value',
'key2' => 'value2'
);
$serialized = serialize($myArray);
echo $serialized;