In this work, we proposed a new approach for learning legged locomotion for any legged robot, in the sagittal plane, by using a combination of classical control techniques and reinforcement learning. Specifically, we use optimal control of the low-order model Spring-Loaded Inverted Pendulum (SLIP), for the planning and generation of expert reference trajectories that resemble the ideal dynamics of animals in nature, and a control policy that learns to imitate these ideal dynamics. The objective of this approach is to provide a generic methodology for learning legged locomotion, that is flexible enough to be applied to robots with different morphological properties, and reduces the impact of simulation inaccuracies in the emergence of unnatural controlled gaits.