The invention discloses a photonic crystal hydrogel film with both pH value and ionic strength responses, a preparation method and application thereof. The photonic crystal hydrogel film includes Fe3O4 nanoparticles and polyacrylamide-methacrylic acid hydrogel; the Fe3O4 nanoparticles are uniformly dispersed in the hydrogel, arranged in a one-dimensional chain, and the nanoparticles in the film The concentration is 1-50 mg / mL. The preparation method of the photonic crystal hydrogel film includes uniformly mixing Fe3O4 nanoparticles and hydrogel monomers, causing a curing reaction by ultraviolet light, and finally immersing in a soluble carbonate aqueous solution to obtain the desired film. The preparation method of the invention is simple in operation, strong in repeatability, convenient for large-scale preparation, the amount of carboxyl groups in the obtained film is controllable, the film is monochromatic, and has obvious color changes under the stimulation of pH value or ionic strength, and is suitable for naked eye detection.