A novel magnetic fluorescent molecularly imprinted sensor for highly selective and sensitive detection of 4-nitrophenol in food samples through a dual-recognition mechanism.