p -Nitrophenol (PNP) is widely used in pesticides, pharmaceuticals, and dyestuffs. It is vital to detect trace PNP in the environment, because it poses significant environmental hazards due to its high toxicity. In this paper, a new method was reported for preparing a SERS substrate with excellent SERS activity by combining self-assembly techniques and flexible materials. First, the three-dimensional (3D) polystyrene (PS) photonic crystal (PC) structural master was fabricated by stacking two layers of self-assembled PS nanospheres with different diameters. Polydimethylsiloxane (PDMS) with a complementary structure to the master was obtained by casting, curing and peeling off. Finally, the PDMS-Ag substrate was fabricated by sputtering a thin Ag layer on the PDMS structure. The enhancement factor (EF) of the PDMS-Ag substrate was calculated to be 2.90 × 10 9 by using 4-amino thiophenol (ATP) as the probe molecule, and the limit of detection (LOD) for ATP can reach 10 -11 M. And the RSD of the SERS intensity for the peak at 1078 cm -1 on the PDMS-Ag substrates from batch to batch was within 2%, indicating the high reproducibility of the as-prepared substrate. The quantitative analysis of PNP was achieved with a LOD of 10 -8 M. Therefore, the PDMS-Ag substrate exhibits high sensitivity and reproducibility, and it can detect PNP in trace amounts, with great potential for detecting other contaminants.