  In this paper, for any odd prime $p$ and an integer $m\ge 3$, several classes
of linear codes with $t$-weight $(t=3,5,7)$ are obtained based on some defining
sets, and then their complete weight enumerators are determined explicitly by
employing Gauss sums and quadratic character sums. Especially for $m = 3$, a
class of MDS codes with parameters $[p,3,p-2]$ are obtained. Furthermore, some
of these codes can be suitable for applications in secret sharing schemes and
$s$-sum sets for any odd $s>1$.
