Herein, a reversible pH fluorescent sensor was developed using caffeic acid as the precursor by one-step solvothermal synthesis method. The carbon dots-based sensor (CA-CDs) exhibited pH-dependent increase in fluorescence intensity and showed linear relationship in the range of pH 6.60 and 8.00. Notably, the fluorescence sensor has a reversible response to pH change. Finally, the CA-CDs has been successfully applied for two-photon imaging of the pH in liver and kidney of diabetic mice. Imaging results showed that the pH value in kidney of diabetic mice was lower than that of the normal mice, while the pH value in liver of diabetic mice was almost the same as that of the normal mice. The present study provides a simple analytical method for pH detection suitable for in vivo.