Traffic congestion is a serious problem faced by many cities worldwide today. Congestion warning information is one of the important influencing factors of urban road congestion; To this end, based on the dynamics of infectious diseases, a congestion warning information dissemination model considering the attitudes of travelers and the network structure was constructed. The existence and stability of the equilibrium points of non congestion warning information and congestion warning information in the model were analyzed, and the optimal control strategy of the model was proposed. Numerical simulation was conducted to verify the results of theoretical analysis, simulate and analyze the impact of changes in various parameters in the model on the dissemination of congestion warning information, and perform sensitivity analysis on several parameters. The results indicate that travelers are more inclined towards “fast” modes of transportation and have a stronger willingness to share congestion warning information. The dissemination range of warning information is wider, which can play a positive role in reducing traffic congestion pressure.