Home  >  Article  >  Backend Development  >  PHP提交到自身页面怎么方式刷新提交

PHP提交到自身页面怎么方式刷新提交

WBOY
WBOYOriginal
2016-06-13 12:15:47912browse

PHP提交到自身页面如何方式刷新提交
form提交给自身页面,刷新后会重复提交,如何防止?
------解决思路----------------------
可以写个js

把我发的你改改

<script language="javascript"><br />function window.onload()<br />{<br />if(window.name==""){<br />window.name = "0";<br />}<br />else{<br />window.name = eval(window.name) + 1;<br />alert("已经刷新"+ window.name+'次');<br />}<br />}<br /></script>

------解决思路----------------------
下面的方法采用的是屏蔽法:  
  <script> <br /> //禁止用F5键 <br /> function document.onkeydown() <br /> { <br /> if ( event.keyCode==116) <br /> { <br /> event.keyCode = 0; <br /> event.cancelBubble = true; <br /> return false; <br /> } <br /> } <div class="clear"></script>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn