Antibacterial lysozyme hydrogels show attractive advantages in wound dressings due to their intrinsic antibacterial activity, excellent biochemical and mechanical properties. Unfortunately, the development of such hydrogels is still greatly limited due to the lack of universal gelation strategies. Herein, a universal gelation strategy between lysozyme-nanofiber (LZF) and inorganic salts is proposed for the first time to construct functional nanofibrous lysozyme-based hydrogels. Specially, divalent anions are found to universally drive LZF for the aggregation and transformation into three-dimensional nanofibrous network hydrogels via electrostatic interaction, and the key role of divalent anions in the gelation is further proved by molecular dynamics simulation. In addition, near infrared light-mediated photothermal characteristics are endowed for LZF to enhance its inhibitory activity of multi-drug-resistant bacteria by the skeleton modification with genipin to produce genipin-conjuagted LZF (GLZF). As a distinct application paradigm, the brilliant immunomemory MnSO 4-crosslinked GLZF hydrogel is constructed to sensitize cGAS-STING pathway and skillfully establish an antibacterial immune microenvironment. It can excellently realize the infected anti-recurrence of diabetic wound via photo-enhanced bacterial killing and cGAS-STING pathway. Thereby, it paves the way to employ the universal divalent anion-mediated gelation strategy for future developing functional inorganic salt-hybrided lysozyme hydrogels.