The specific application cannot be said. writing this function is purely for fun. it may be useful in the small pendants of the website, or some living websites are suitable. before entering this topic, you must use PHP to insert the second-level data of provinces, cities, and zones in JSON format into the database before you can perform the following weather query operations. After the provincial and municipal information is imported into the database, let's take a look at the implementation idea: the front-end executes ajax requests through the search box.
The specific application cannot be said. writing this function is purely for fun. it may be useful in the small pendants of the website, or some living websites are suitable. before entering this topic, you must use PHP to insert the second-level data of provinces, cities, and zones in JSON format into the database before you can perform the following weather query operations. After the provincial and municipal information is imported into the database, let's take a look at the implementation idea: the front-end executes ajax requests through the search box, and the backend queries the city code based on the city name, then, the city code is assembled into an API to obtain the city's weather information and return it to the front-end. the code is as follows:
1. foreground code weather. php: