Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个多维数组,如下所示:
array('name' => array('title'=>'Title','date'=>'Created'))
我将它存储为 JSON 'array',当我解码它时,我想通过它的编号来访问每个项目,所以我想要一个索引数组。
我怎么能在 PHP 中解决这个问题?
蒂姆
根据您的最后评论蒂姆,这将实现您的要求..但我不确定您为什么要根据您最初的问题进行此操作。
$foo = array('name' => array('title'=>'Title','date'=>'Created')); $bar = array_values($foo); print_r($bar); // Array ( [0] => Array ( [title] => Title [date] => Created ) )