In this paper, a data-based state feedback control method is developed for a class of nonlinear systems. It is a real-time control method, which requires little prior knowledge about the system dynamics, and does not need to know or to build the mathematical model of the system. We apply a fast sampling technique to sample the state signal, which contains useful information of the system. The zero-order hold (ZOH) and the control switch are also used to obtain system information. The feedback gain matrix is calculated and adjusted according to these sampled data. Theoretical analysis on the convergence and simulation results demonstrate the feasibility of this data-based control method.