All 12 boys from a Thai soccer team and their coach have been rescued from a cave, ending an ordeal that lasted more than two weeks, according to officials.