ZIF-8 sacrificial-templated hollow COF architectures enabled highly efficient enrichment, determination and regulation of food hazards from infant formulas.