BackgroundNitroaromatic compounds are inherently hazardous and explosive, so convenient and rapid detection strategies are needed for the sake of human health and the environment. There is an urgent demand for chemical sensing materials that offer high sensitivity, operational simplicity, and recognizability to effectively monitor nitroaromatic residues in industrial wastewater. Despite its importance, the mechanisms underlying fluorescence quenching or enhancement in fluorescent sensing materials have not been extensively researched. The design and synthesis of multiresponsive fluorescent sensing materials have been a great challenge until now. ResultsIn this study, a one-dimensional Cd-based fluorescent porous coordination polymer (Cd–CIP-1) was synthesized using 5-(4-cyanobenzyl)isophthalic acid (5-H2CIP) and 4,4′-bis(1-imidazolyl)biphenyl (4,4′-bimp) and used for the selective detection of nitrobenzene in aqueous solution by fluorescence quenching, with a limit of detection of 1.38 × 10−8 mol L−1. The presence of aniline in the Cd–CIP-1 solution leads to the enhancement of fluorescence property. Density functional theory and time-dependent density functional theory calculations were carried out to elucidate the mechanisms of the fluorescence changes. This study revealed that the specific pore size of Cd–CIP-1 facilitates analyte screening and enhances host-guest electron coupling. Furthermore, π–π interactions and hydrogen bond between Cd–CIP-1 and the analytes result in intermolecular orbital overlap and thereby boosting electron transfer efficiency. The different electron flow directions in NB@Cd–CIP-1 and ANI@Cd–CIP-1 lead to fluorescence quenching and enhancement. Significance and noveltyThe multiresponsive coordination polymer (Cd–CIP-1) can selectively detect nitrobenzene and recognize aniline in aqueous solutions. The mechanism of fluorescence quenching and enhancement has been thoroughly elucidated through a combination of density functional theory and experimental approaches. This study presents a promising strategy for the practical implementation of a multiresponsive fluorescent chemical sensor.