The invention discloses a method for synthesizing methylated products of
nitrogen heterocyclic and
oxygen heterocyclic compounds, which comprises the following synthesis processes: firstly, placing a target
heterocyclic compound in a glass reaction container, then adding
dimethyl sulfoxide (DMSO) as a
methyl donor and a
solvent, adopting
fluorescein as a photocatalyst, adding 1, 2, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4-trimethyl-1, 3, 4 2, 4-diazabicyclo [2.2. 2]
octane (
DABCO) is used as an alkaline additive. Under the condition of
room temperature, a
blue light source with the power being 10 watts and the
wavelength being 455 nanometers is used for carrying out illumination stirring reaction. And after the reaction is completed, purifying through a
column chromatography separation technology to finally obtain the methyl-substituted
nitrogen heterocyclic or
oxygen heterocyclic compound. The unique photocatalytic
system disclosed by the invention can efficiently realize
methylation reaction of
nitrogen heterocyclic ring and
oxygen heterocyclic ring without depending on a
metal catalyst or a strong oxidant, and excellent yield and good functional group compatibility are obtained.