The present invention relates to an ophthalmic pharmaceutical composition, comprising 0.06 to 40 parts by weight of a solid matrix, 0.4 to 55 parts by weight of a liquid matrix and 1 part by weight of an active pharmaceutical ingredient; the solid matrix is selected from the group consisting of polylactic acid, polyglycolic acid, polylactic acid-co-glycolic acid copolymer, and polyethylene glycol with a number average molecular weight of 800 to 10,000; the liquid matrix is a first liquid matrix and/or a second liquid matrix; the first liquid matrix is selected from the group consisting of diethyl succinate, diethyl tartrate, dimethyl glutarate and glycerol triacetate; when the liquid matrix is the first and second liquid matrixes, the second liquid matrix is selected from the group consisting of glycerol, propylene glycol, and polyethylene glycol with a number average molecular weight 70-750; when the liquid matrix is the second liquid matrix, the second liquid matrix is glycerol and/or propylene glycol, or a combination thereof with polyethylene glycol having a number average molecular weight of 70 to 750.