Zhang's family was based in
Nanyang Commandery. He had at least one brother, Zhang Chang, who held commandery office under
Emperor Huan and in the offices of General-in-Chief
Dou Wu in 168 (De Crespigny, 1036). Zhang Wen was a protégé of the influential court eunuch
Cao Teng and served in the Imperial Secretariat during Emperor Huan's reign. In 164, Zhang accompanied Emperor Huan on a progress to the
Yangtze River, an event memorialized by an anecdote about an old man who piqued Zhang's curiosity by ignoring the passing imperial entourage. When Zhang approached him, the old man criticized the emperor's luxurious lifestyle and the accordant burdens placed on the populace, allegedly prompting Zhang to feel ashamed. Zhang later served as Administrator of
Yingchuan Commandery. By 184, he was
Minister of Finance, and was promoted in the same year to the prime ministerial office of
Grand Excellency of Works. Although Zhang was considered a competent official and well-qualified for the post, he was compelled to pay a bribe to secure his appointment, pursuant to a much-criticized practice introduced by the reigning Emperor Ling. Zhang was serving as Grand Excellency at the time of the
Yellow Turban Rebellion and persuaded the emperor not to dismiss the military commander
Zhu Jun, who ultimately achieved success in his campaign against Yellow Turbans in Nanyang Commandery. In 185, following the failure of the general
Huangfu Song to suppress a
multiethnic rebellion in Liang Province, Zhang was appointed General of Chariots and Cavalry and assigned to lead a 100,000-strong army against the rebels. Zhang experienced difficulty in managing his subordinate general
Dong Zhuo, who reportedly treated Zhang with disdain. Nevertheless, recognizing Dong's popularity among the soldiery, Zhang allegedly rejected the urgings of his military advisor
Sun Jian that Dong be executed. Zhang's campaign was inconclusive, despite a victory scored by Dong in the winter of 185-186, and although he was appointed
Grand Commandant in 186, he resigned in the following year due to the continued unrest. In 188, Zhang returned to office as Colonel-Director of Retainers, which, while not a prime ministerial office, was a highly influential position that reported directly to the emperor. While serving in this role, he recommended that Emperor Ling assign
He Xun, who at the time was plotting a coup against the eunuch faction, as intendant of
Jingzhao Commandery. Although Emperor Ling, who favored He, was reluctant to follow Zhang's recommendation, the eunuch
Jian Shi persuaded him to do so and He was duly assigned to Jingzhao. In the following year, Emperor Ling died and the court came under the control of Dong Zhuo, by now a preeminent western warlord. Establishing himself as a
de facto regent, Dong deposed Emperor Ling's heir
Emperor Shao and installed Emperor Ling's younger son,
Emperor Xian, on the throne before moving the court west, from
Luoyang to
Chang'an, in the face of
coalescing military opposition from the eastern aristocracy. Zhang accompanied the court to Chang'an and was appointed
Minister of the Guards by 191. Displeased with Dong's harsh rule, Zhang conspired against him with
Wang Yun, the
Grand Excellency Over the Masses and Prefect of the Masters of Writing. Before these efforts could bear fruit, Dong was advised by the court astronomer of a prophecy foretelling the death of a prominent minister and ordered Zhang's execution as a means of satisfying the prophecy, accusing him of communicating with the eastern coalition. Zhang was executed on 5 November 191 by being flogged to death in the Chang'an marketplace. ==In
Romance of the Three Kingdoms==