A dual-functional nanoplatform is demonstrated that is found to have the characteristics of cancer cell targeting, pH response, near-infrared fluorescence imaging, and lysosome targeting. It can simultaneously achieve pyroptosis and ferroptosis under the mediation of photons for cancer immunotherapy.