$a = Array
(
Array (
'cid' => 1,
'cname' => '关于'
),
Array (
'cid' => 7,
'cname' => '简介'
),
Array (
'cid' => 8,
'cname' => '文化'
),
Array (
'cid' => 9,
'cname' => '动态'
)
);
$b = Array
(
Array (
'cid' => 1,
'cname' => '关于'
),
Array (
'cid' => 2,
'cname' => '歌剧'
),
Array (
'cid' => 3,
'cname' => '美剧'
),
Array (
'cid' => 4,
'cname' => '视频'
),
Array (
'cid' => 5,
'cname' => '娱乐'
),
Array (
'cid' => 6,
'cname' => '联系'
),
Array (
'cid' => 7,
'cname' => '简介'
),
Array (
'cid' => 8,
'cname' => '文化'
),
Array (
'cid' => 9,
'cname' => '动态'
)
);
$c = Array
(
Array (
'cid' => 1,
'cname' => '关于'
),
Array (
'cid' => 7,
'cname' => '简介'
),
Array (
'cid' => 8,
'cname' => '文化'
),
Array (
'cid' => 9,
'cname' => '动态'
),
Array (
'cid' => 2,
'cname' => '歌剧'
),
Array (
'cid' => 3,
'cname' => '美剧'
),
Array (
'cid' => 4,
'cname' => '视频'
),
Array (
'cid' => 5,
'cname' => '娱乐'
),
Array (
'cid' => 6,
'cname' => '联系'
)
);
已知$a,参照$a把$b排序成$c的样子。
使用自定义排序函数usort来一发