Multi-heteroatom-doped dual carbon-confined Fe3O4 nanospheres as high-capacity and long-life anode materials for lithium/sodium ion batteries.