A former middle school teacher in Lee County was sentenced to 18 years in prison for sex crimes against students, the sheriff’s office said.