Three-dimensional (3D) printed bioactive scaffolds have been widely used in the field of bone tissue engineering. However, its visualization in vivo and bacterial inflammation are intractable issues during the surgery and treatment. Herein, we firstly synthesized an aggregation-induced emission-active luminogen (AIEgen), named as 4BC, with efficient reactive oxygen species (ROS) generation. Then, a series of 3D bioactive scaffolds loading 4BC were fabricated by precipitation adsorption method, namely 4BC@scaffolds, which showed good in situ imaging performance for the implanted scaffolds by using simple UV light irradiation. Among them, 4BC@TMP scaffold composed of trimagnesium phosphate (TMP) had an excellent bactericidal ability for E. coli and S. aureus in vitro and resisted bacterial inflammation in vivo through photodynamic action. H&E and immunofluorescence staining were performed to further evaluate the inhibitory effect of bacterial inflammation in vivo. This work verified that AIEgen-based 3D scaffolds are promising bioactive frameworks for bioimaging and antibacterial application.