A one-step method for preparing a hierarchical mesoporous-porous TiO2/g-C3N4 nanofiber photocatalytic material comprises the following steps: sequentially adding N,N-dimethylformamide and glacial acetic acid into absolute ethyl alcohol, and uniformly stirring; adding urea, and completely dissolving; adding polyvinylpyrrolidone, and completely dissolving; adding tetrabutyl titanate, and completelydissolving; adding liquid paraffin, and stirring for 24 h or above; putting the obtained mixture into an injector, carrying out electrostatic spinning under a certain condition, and collecting the obtained spinning product by using a stainless steel disc; and drying the spinning product, and roasting the dried spinning product in a crucible with a cover in an air atmosphere at 550 DEG C for 4 h. The method is simple and rapid, low in cost, wide in spectral response range and low in broad-spectrum carrier recombination rate, the photo-induced electron-hole recombination rate is reduced througha one-dimensional structure, the light scattering effect is enhanced through a macroporous structure, the light capturing capacity is improved, and diffusion of reactant molecules is promoted. The mesoporous structure increases the specific surface area, and provides more active sites, so the product is applied to photocatalytic cracking of water to produce hydrogen.