A fluorescent ultrathin film (CTA-AgNCs/LDH) is developed for the determination of melamine with high selectivity, low detection and practical utility.