Solar steam generation has attracted widespread attention because of its ability to produce clean water through desalination and wastewater treatment without conventional energy consumption. In this work, a polyaniline (PANI)-coated sodium alginate (SA)/cattail fiber (CF) foam for photothermal evaporator is prepared via directional freezing and oxidative polymerization. The SA/CF foam displays desirable water pumping capability because of the lamellar sandwich structure interconnected by porous networks. More importantly, the directional porous network architecture ameliorates the mechanical and salt-resistant performances of the SA/CF foam. The as-prepared PANI@SA/CF foam shows inferior heat conductivity of 0.047 W m−1 K−1 and outstanding light absorption over 96% in solar window. A vapor evaporation rate of 2.04 kg m−2 h−1 under 1 sun illumination is achieved for the PANI@SA/CF evaporator. Furthermore, the PANI@SA/CF foam could be employed in solar-driven freshwater generation from seawater and wastewater with high ion and dye removal rates. The combination of water evaporation and cleaning capabilities of the PANI@SA/CF foam as photothermal materials provide a framework for the exploration of next-generation evaporators in seawater desalination and wastewater treatment applications.