The effects of a magnesium-based layered composite on the flammability of a phenolic epoxy resin (EP) are studied. In order to produce the required composite material, first, magnesium hydroxide, aluminum salt and deionized water are mixed into a reactor according to a certain proportion to induce a hydrothermal reaction; then, the feed liquid is filtered out using a solid-liquid separation procedure; finally, the material is dried and crushed. In order to evaluate its effects on the flammability of the EP, first, m-phenylenediamine is added to EP and vacuum defoamation is performed; then, EP is poured into a polytetrafluoroethylene mold, cooled to room temperature and demoulded; finally, the magnesium-based layered composite is added to EP, and its flame retardance is characterized by thermogravimetric analysis, limiting oxygen index and cone calorimetry. The X-ray diffraction patterns show that the baseline of magnesium-based layered composite is stable and the front shape is sharp and symmetrical when the molar ratio of magnesium to aluminium is 3.2:1; with the addition of magnesium-based layered composite, the initial pyrolysis temperature of EP of 10%, 15% and 30% magnesium-based layered composite decreases to 318.2°C, 317.9°C and 357.1°C, respectively. After the reaction, the amount of residual carbon increases to 0.1%, 3.45% and 8.3%, and the limiting oxygen index increases by 28.3%, 29.1% and 29.6%, respectively. The maximum heat release rate of cone calorimeter decreases gradually. The optimum molar ratio of Mg:Al for green synthesis is 3.2:1, and the NO3-intercalated magnesium-based layered composite has the best flame retardance properties.