Inspired by the light-gated ion channels in cell membranes that play important roles in many biological activities, herein, we developed an artificial light-gated ion channel membrane out of conjugated microporous polymers. Through bottom-up design of the monomer molecular structure and by the electropolymerization method, the membrane pore size and thickness were precisely controlled on the molecular level. The obtained membrane exhibited uniform pore size and highly sensitive light-switchable response. The photoisomerization of the polymer chain resulted in a reversible “on and off” light control over the pore size and subsequently led to light-gated ion transport across the membrane for a series of ions including hydrogen, potassium, sodium, lithium, calcium, magnesium, and aluminum ions.