In this paper, we give a general and weak sufficient condition to guaranteeing the existence and infinite homoclinic solutions for some classes of differential equations, in particular for a class of Hamiltonian systems. We illustrate our main theoretical results by an application.