Home  >  Article  >  Backend Development  >  Thinkphp Learn and Use - Unintentional Mistakes in Verification Code_PHP Tutorial

Thinkphp Learn and Use - Unintentional Mistakes in Verification Code_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:17:381167browse

Thinkphp learning and using at the same time - Verification code unintentional mistakes

Look at the code first:
1 $(".verify_img").click(function(){
2 var timenow = new Date().getTime();
3 var url="{:U('index/loginverify')}&t="+timenow;
4 alert(url);
5 $(this).attr("src",url)
6 });
The above code causes the verification code to be clicked to switch and the verification code image cannot be displayed.
Look at the following code again:
$(".reloadverify").click(function(){
var timenow = new Date().getTime();
var url="{:U('index/loginVerify')}?t="+timenow;
$("#image_d").attr("src",url)
});
What is the area of ​​the above code? The difference between &. After comparison, you can see where the problem lies. It is also valid to directly follow a random number after the question mark. var url="{:U('index/loginVerify')}?"+Math.random();
The problem is already very clear when I write this.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/890646.htmlTechArticleThinkphp Learn and use - Verification code unintentional mistakes. Look at the code first: 1 $(.verify_img). click(function(){ 2 var timenow = new Date().getTime(); 3 var url ={:U(index/loginverify)}t=+time...
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