A noval ternary nanocomposite AgCl/Ag3PO4/g-C3N4 was successfully synthesized for photocatalytic degradation of methylene blue, methylparaben and inactivation of E. coli under visible light irradiation, showing excellent photocatalytic degradation performance and stability.