  We study the gamma-ray spectra of 30 globular clusters (GCs) thus far
detected with the Fermi Gamma-ray Space Telescope. Presuming that gamma-ray
emission of a GC comes from millisecond pulsars (MSPs) contained in, a model
that generates spectra for the GCs is built based on the gamma-ray properties
of the detected MSP sample. We fit the GCs' spectra with the model, and for 27
of them, their emission can be explained with arising from MSPs. The spectra of
the other three, NGC 7078, 2MS-GC01, and Terzan 1, can not be fit with our
model, indicating that MSPs' emission should not be the dominant one in the
first two and the third one has a unique hard spectrum. We also investigate six
nearby GCs that have relatively high encounter rates as the comparison cases.
The candidate spectrum of NGC 6656 can be fit with that of one MSP, supporting
its possible association with the gamma-ray source at its position. The five
others do not have detectable gamma-ray emission. Their spectral upper limits
set limits of $\leq 1$ MSPs in them, consistent with the numbers of radio MSPs
found in them. The estimated numbers of MSPs in the gamma-ray GCs generally
match well those reported for radio pulsars. Our studies of the gamma-ray GCs
and the comparison nearby GCs indicate that the encounter rate should not be
the only factor determining the number of MSPs a GC contains.
