我正在尝试将db返回的结果分配给数组
我有
$results = Db::get('get_items', array('id' =>$id));
$Info['items'][1]['title'] = $results[0]['Name'];
$Info['items'][1]['name'] = $results[0]['Filename'];
$Info['items'][1]['type'] = $results[0]['Type];
DB 只返回 1 行数据。
我需要我的$info样子如下
Array
(
[items] => Array
(
[1] => Array
(
[title] => Title test
[filename] => test.xml
[type] => company
)
)
[mis] => data
)
我想知道是否有更好的方法来分配价值,$info而不仅仅是hardcoded所有这些。非常感谢!