This study utilizes the micro-structure with periodic varying refractive index to introduce the specific defect layer to form a one-dimensional photonic crystal resonant cavity. The influences of the thickness of defect layer on the resonant wavelength and its quality factor were studied with optical transmission matrix method. At the same time, we compare forward incidence with diagonal incidence and discuss the difference between their quality factors. Through numerical simulating, we can obtain the extra-narrow transmission peak will shift toward low frequency and the quality factor increases observably with the gradual incremental incident angel. To promote quality factor by increasing the resonant peaks within the same range of wavelength, we utilize the symmetrical structure with two same characteristic defect layers to achieve. As we vary the refractive index of either defect layer, the obvious slash of transmissivity will form a optical switching device.