Spectrum detection is a critical technology in cognitive radio, which involves two very important parameters: detection period and detection time. Firstly, in order to improve spectrum efficiency and reduce the interference to authorized users, detection period optimization is adopted to maximize spectrum access opportunities and minimize the interference to authorized users. Secondly, under the target detection probability constraints, detection time optimization is adopted to maximize the achievable normalized throughput when CR user detects the channel. At last, we develop the joint-optimization algorithm of detection period and detection time. Compared with the method in literature [9], it can be found that our joint-optimization algorithm can actually improve spectrum access opportunities. Compared with single-optimization method of detection period and detection time, our algorithm can also greatly improve the achievable normalized throughput when CR user detects the channel