Magnetic fluid is a good magneto-optical material. In this paper, a kind of side-etch photonic crystal long-period grating based on magnetic fluid filling is proposed. Simultaneous detection of magnetic field strength and temperature through integrated surface plasma resonance (SPR) and long period grating (LPG) sensing. The refractive index of magnetic fluid changes with the influence of magnetic field intensity and temperature. Based on the above sensing mechanism, the test results show that the magnetic field intensity sensitivity of the LPG sensor is −35.91 pm∕GS, and the temperature sensitivity is 51.4 pm∕°C. The temperature sensitivity of the SPR sensor is −568 pm∕°C, which accurately compensates for temperature crosstalk. The calculated error rate is E ðΔBÞ ¼ 0.124%; E ðΔT Þ ¼ 0.308%. The sensor structure provides a good application prospect for precise magnetic field intensity measurements.