Neural networks are a potential method to solve partial differential equations (PDEs) without considering equation discretization, linearization, and solving large sparse linear systems. Some data-driven or physics-informed methods are studied for surrogate modeling and uncertainty quantification tasks for PDE systems. Compared with data-driven methods, physics-informed methods reduce the reliance on labeled data and have better generalizations and broader applications. However, the methods have low accuracy for solving non-stationary problems with strong nonlinearities. This paper proposes a physics-informed method to solve a porous flow equation with a single source or sink as the boundary condition. The present network framework consists of two network modules. The first module uses two hidden layers with frozen weights, obtained by pre-training a simple double hidden layer network using boundary conditions and initial conditions as loss functions. The second module is used as a residual module to learn measurable label data to improve the accuracy of the solution on the nonlinear boundary. The numerical results verify the validity of the PDE solution, and the results show that the method performs better in terms of both solution and prediction than existing methods. In addition, the method allows a good inversion of the permeability from the measurable data.