The invention discloses a method for rapidly measuring a p-hydroxy-benzoate ester in cosmetics and relates to a method for measuring components in the cosmetics. The method comprises the following steps: A, treating a sample to be measured; B, establishing a background spectral database, namely B1, acquiring spectral data of a cosmetic sample; B2, acquiring spectral data of components to be measured; B3, converting the data format; B4, acquiring spectral data of a background which does not contain the components to be measured; B5, reducing the dimensionality of a background database; C, acquiring a standard spectral database v of the p-hydroxy-benzoate ester; D, measuring a spectrum of the cosmetic sample to be measured; E, measuring the content of the p-hydroxy-benzoate ester in the cosmetic sample to be measured. The method is high in analysis efficiency, low in operating strength and low in analysis cost, the background database which does not contain the measured components is not required to be accumulated, the machine hour and the reagent loss can be reduced, the robustness is high, and the method is simple and suitable for rapidly analyzing and measuring the same type of large-scale samples.