Partial differential equations (PDEs) that describe many physical phenomena are discovered or derived based on professional knowledge or empirical observations. However, the rapid development of machine learning technology interests us to discover the PDEs with a data-driven approach based on neural networks. We introduce the convolution neural network (CNN) to learn the time-dependent PDEs. Instead of customizing a complex regularization term in loss function, we introduce a series of constraints on the structure of neural network model to avoid the overfitting problems. Firstly, since the linear PDEs can be accurately approximated by a linear CNN, we construct a network consisting of a linear CNN and a nonlinear CNN. The linear CNN helps to mitigate the overfitting problems of learning nonlinear PDEs. Secondly, the boundary conditions are hard encoded into the neural networks by custom padding operations. Finally, the time-series data are learned by an auto-regressive framework corresponding with the Euler scheme. We test the proposed framework with a series of PDEs, including heat equation, Burgers equation, reaction-diffusion equation and Kuramoto–Sivashinsky equation. Moreover, we also test the two-dimensional equations, and it shows similar accuracy as one-dimensional case. These numerical results demonstrate that the proposed framework is able to learn the PDEs from few data more accurately and stably.