// 需要替换 key 的数组 $arr_old = array( '0' => array('id' => 1, 'name' => 'Carroll'), '1' => array('id' => 2, 'name' => 'Chrdai'), '3' => array('id' => 3, 'name' => 'xiaodai'), ); // 将新的key定义一个新数组 $key_name = array('key1','key2','key3'); // 现在开始替换 $arr_new = array_combine($key_name,$arr_old); var_dump($arr_new); /* array (size=3) 'key1' => array (size=2) 'id' => int 1 'name' => string 'Carroll' (length=7) 'key2' => array (size=2) 'id' => int 2 'name' => string 'Chrdai' (length=6) 'key3' => array (size=2) 'id' => int 3 'name' => string 'xiaodai' (length=7) */