A porphyrin-based optical sensor membrane prepared by electrostatic self-assembled technique for online detection of cadmium(II).