The diffusion and transport of substances between a hydrogel and its environment have received tremendous research interest, due to the wide range of applications of hydrogel materials in fields related to drug carriers and drug delivery vehicles. To date, much research has been done to tailor the diffusion and transport of substances through hydrogels, where most efforts were focused on tuning the 3D network properties of the hydrogel including loop size, hydrophobicity of building blocks and the stimuli-responsive properties of backbones. These conventional strategies, however, usually suffer from complicated fabrication procedures and result in a homogeneous increase in hydrophobicity of the hydrogel network, leading to low efficiency control over the diffusion of substances through the hydrogel. Herein, a facile strategy that can functionalize the surfaces of hydrogels, while keeping the interior network unchanged, was reported, and is realized by quaternization reaction confined to the hydrogel/oil interface. Owing to the introduction of the photo-responsive molecule IBSP as a modifier, the surface wettability of the resulting hydrogel can be controlled by light both in air and underwater environments. Consequently, the diffusion rate of a substance through this modified hydrogel can be regulated by light, which brings convenience to the controlled release of hydrogels and other hydrogel-related fields.