The invention discloses a tungsten sulfide-black titanium dioxide heterojunction-based method for detecting 5fC via photoelectrochemical analysis. According to the method, a photoelectrochemical biosensor for detecting the 5fC is firstly constructed; and the photoelectrochemical biosensor comprises an electrode, and a thin-layer tungsten sulfide nanosheet, AuNPs, 4-amino-3-hydrazino-5-sulfydryl-1,2,4-triazole, 5fC and black titanium dioxide, which are modified on the surface of the electrode in sequence. According to the method, the good photoelectric activity of WS2, the effect of the AuNPs on accelerating the electron transfer, and the specific covalent reaction of a diamine group on 4-amino-3-hydrazino-5-sulfydryl-1,2,4-triazole and an aldehyde group on the 5fC are utilized, and the black titanium dioxide is used as a signal amplification molecule, so that the sensitive detection for 5-formylcytosine is realized. The detection method provided by the invention is high in operation stability, strong in sensitivity, low in detection limit and convenient to realize miniaturization, and is capable of realizing the rapid and sensitive detection for the 5fC through only modifying the surface of the ITO electrode.