The invention discloses a method for measuring p-hydroxybenzoate in cosmetics and relates to a method for measuring components in cosmetics. The method comprises the following steps: A, performing tested sample treatment, namely preparing the tested cosmetics into diluent; B, performing spectral measurement, namely B1, preparing a background spectrum set, B2, determining the standard spectrum of p-hydroxybenzoate, and B3, performing spectral measurement on the tested cosmetics; C, performing positive test and content measurement, namely C1, performing positive test, calculating an included angle between the merged matrix and the standard spectrum of p-hydroxybenzoate, when the included angle is larger than 0.15, the p-hydroxybenzoate is judged to be negative, and the spectrum of the tested cosmetics is recorded into the background spectrum database, and when the included angle is smaller than 0.1, the p-hydroxybenzoate is stored in the tested cosmetics, the sample is positive, and continuing, and C2 performing content measurement, namely deducing the standard spectrum of p-hydroxybenzoate from the spectrum of the tested cosmetics, thereby obtaining the actual content of the p-hydroxybenzoate. The method is high in analysis efficiency, low in operation strength, low in analysis cost, high in robustness and easy to popularize and use.