The photovoltaic effect is gaining growing attention in the optoelectronics field due to its low power consumption, sustainable nature, and high efficiency. However, the photovoltaic effects hitherto reported are hindered by the stringent band-alignment requirement or inversion symmetry-breaking, and are challenging for achieving multifunctional photovoltaic properties (such as reconfiguration, nonvolatility, and so on). Here, a novel ionic photovoltaic effect in centrosymmetric CdSb2Se3Br2 that can overcome these limitations is demonstrated. The photovoltaic effect displays significant anisotropy, with the photocurrent being most apparent along the CdBr2 chains while absent perpendicular to them. Additionally, the device shows electrically-induced nonvolatile photocurrent switching characteristics. The photovoltaic effect is attributed to the modulation of the built-in electric field through the migration of Br ions. Using these unique photovoltaic properties, a highly secure circuit with electrical and optical keys is successfully implemented. The findings not only broaden the understanding of the photovoltaic mechanism, but also provide a new material platform for the development of in-memory sensing and computing devices.