As a new service model in the field of travel, online ride-hailing has not only facilitated people"s travel but also exerted a certain impact on the society. Among them, the impact to public transport caused extensive discussion. However, up to now, there are few empirical studies on it. Based on the data of 276 prefecture-level cities in China from 2004 to 2017, this paper described the influence mechanism of online ride-hailing on public transport and the moderating effect of the legitimacy. Results show that :(1) the emergence of online ride-hailing reduced the bus ridership, but increased the rail ridership; (2) in 2017, some regions began to issue business licenses for online ride-hailing, which clarified the legitimacy of ride-hailing, thus promoting the use of two types of public transport services. The conclusion provides a theoretical basis for better management of online ride-hailing platform.