Чжили
Zhang was born in Xingyi Prefecture (), Guizhou Province, but his ancestral roots were in Nanpi, Tianjin, Zhili Province. He was the cousin of Zhang Zhiwan. In 1852, he sat for the provincial-level imperial examination in Shuntian Prefecture (present-day Beijing) and achieved the top position as "jieyuan" () in the "juren" class. In 1863, he sat for the palace-level examination and emerged as "tanhua" (), the third highest-ranked candidate of the "jinshi" class. He was then admitted to the Hanlin Academy as a "bianxiu" (編修; editor) before taking up other positions, including "jiaoxi" (), "shidu" () and "shijiang" (). In 1882, he was transferred as the "xunfu" (provincial governor) of Shanxi Province. Empress Dowager Cixi promoted him to Viceroy of Huguang in August 1889.