In this paper, we employ general results on the value distributions of perfect nonlinear functions from F pm to F p to give a unified approach to determining the weight distributions of two classes of linear codes over F p constructed from perfect nonlinear functions, where p is an odd prime and m is an odd number. When m is even, we give some mild additional conditions for similar conclusions to hold.