Emperor Wu of the Han Dynasty set the county for five years and established its capital here for seven years. Since then, the Western Han Dynasty, the Eastern Han Dynasty, the Western Jin Dynasty, the former Zhao Dynasty, the former Qin Dynasty, the later Qin Dynasty, the Western Wei Dynasty, the Northern Zhou Dynasty, the Sui Dynasty and Tang Dou all took it as their capital, and the Eastern Han Dynasty, the Three Kingdoms, the Wei and Jin Dynasties and the Tang Dynasty all took it as their capital. At the end of the Western Han Dynasty, the green forest was red-browed, and at the end of the Tang Dynasty, the peasant uprising army led by Huang Chao also built its capital here. The Han and Tang dynasties were also the center of foreign economic and cultural exchanges. In the Western Han Dynasty, there were residences for foreigners in the city. There were millions of foreigners living in the Tang Dynasty from all over Asia as far away as Poland.