The selective separation of ions in terms of extremely similar size and properties remains an important challenge in water purification. We innovated a kind of porous nanofilm via interfacial polymerization using rigid heterocyclic ligands to achieve high valent cation selectivity and rapid water/ion transport. The interconnected microporosity and uniformly distributed cation-affinitive sites of the ultrathin membranes enabled water permeation (7.5 L m-2 h-1 bar-1), ion permeance of Na+ (1.5 mol m-2 h-1 bar-1), and Mg2+/Na+ permselectivity (2.1) during nanofiltration. The forward osmosis exhibited a prominent water flux of 95 LMH at 1 M NaCl draw solution, which expanded various applications. The polyarylate membranes comprising 4,7-diphenyl-1,10-phenanthroline showed a higher water permeation and ion selectivity than the planar monomers, e.g., resorcinol. A distinct fluorescence responsiveness existed between membranes and cations for the interaction characterization. Host-guest nuclear magnetic resonance (NMR) spectroscopy and solid-state nuclear magnetic resonance spectroscopy characterized the preferential affinitive of divalent/high-valent cations in the interconnected microporous powders; an ultraviolet spectrophotometer characterized the light responsiveness of the porous nanofilms. Such an active membrane has potential applications in selective separation and adsorption of cations, photocatalytic materials, photosensors, and other fields.