It is obtained from the condensation reaction of phenol and ethyl acetoacetate. Stir phenol, ethyl acetoacetate and newly steamed nitrobenzene together, heat to 100 ℃, and add anhydrous aluminum trichloride-nitrobenzene solution dropwise within 45min. The temperature was raised to 130 ℃, and the heat preservation reaction was carried out for 3 hours until hydrogen chloride almost stopped escaping. Cool to room temperature, add hydrochloric acid to decompose excess aluminum trichloride under stirring. Then steam distillation is carried out to remove unreacted ethyl acetoacetate and nitrobenzene. The residue is left to the water layer, the oil layer is filtered and then distilled under reduced pressure. Nitrobenzene is first distilled, and then the fraction at 180-195 ℃(2.0kPa) is collected, which is 4-methylcoumarin.