The spatial structure has often been identified as a prominent mechanism that substantially promotes the cooperation level in prisoner's dilemma game. In this paper we introduce a weighting mechanism into the spatial prisoner's dilemma game to explore the cooperative behaviors on the square lattice. Here, three types of weight distributions: exponential, power-law and uniform distributions are considered, and the weight is assigned to links between players. Through large-scale numerical simulations we find, compared with the traditional spatial game, that this mechanism can largely enhance the frequency of cooperators. For most ranges of b, we find that the power-law distribution enables the highest promotion of cooperation and the uniform one leads to the lowest enhancement, whereas the exponential one lies often between them. The great improvement of cooperation can be caused by the fact that the distributional link weight yields inhomogeneous interaction strength among individuals, which can facilitate the formation of cooperative clusters to resist the defector's invasion. In addition, the impact of amplitude of the undulation of weight distribution and noise strength on cooperation is also investigated for three kinds of weight distribution. Current researches can aid in the further understanding of evolutionary cooperation in biological and social science.