The preparation of a highly oriented photoluminescent film of fluorescein (FLU) and 1-heptanesulfonic acid sodium (HES) co-intercalated in a layered double hydroxide (LDH) matrix by electrophoretic deposition (EPD) is reported, and its application as an optical pH sensor is demonstrated. The FLU-HES/LDH films with thickness ranging from nanometer to micrometer on indium tin oxide substrates exhibite good c-orientation of LDH platelets (the ab-plane of the LDH platelets parallel to the substrate), as confirmed by X-ray diffraction and scanning electron microscopy. Polarized luminescence of the film is observed with anisotropy value r = 0.29, resulting from the highly oriented FLU in the LDH gallery. Furthermore, the optical pH sensor with film thickness of 300 nm exhibits a broad linear dynamic range for solution pH (5.02–8.54), good repeatability (relative standard deviation (RSD) less than 1.5% in 20 consecutive cycles) and reversibility (RSD less than 1.5% in 20 cycles), high photostability and storage stability (ca. 95.2% of its initial fluorescence intensity remains after one month) as well as fast response time (2 s). Therefore, this work creates new opportunities for the preparation and application of LDH-based chromophores in the field of optical sensors.