Home > Backend Development > PHP Tutorial > Simple implementation method of thinkPHP3.1 verification code, thinkphp3.1 verification code_PHP tutorial

Simple implementation method of thinkPHP3.1 verification code, thinkphp3.1 verification code_PHP tutorial

WBOY
Release: 2016-07-12 08:53:53
Original
764 people have browsed it

A simple implementation method of thinkPHP3.1 verification code, thinkphp3.1 verification code

The example in this article describes a simple implementation method of thinkPHP3.1 verification code. Share it with everyone for your reference, the details are as follows:

Write in the code:

public function verify(){
    import('ORG.Util.Image');
    ob_clean();
    Image::buildImageVerify();
}

Copy after login

Write in html:

<img src='__APP__/Index/verify/'
  onClick="this.src=this.src+'&#63;'+Math.random()"
/>

Copy after login

That is to say, the path of the image is the access path of the above php code, and it is ok

If the image is not displayed, it is ob_clean(); it is not written. This method is to remove the cache and so on

If it is garbled, just write the above php code directly in front of the display method. Remember, this method is separate and should not be mixed with other methods

Readers who are interested in more thinkPHP-related content can check out the special topics on this site: "ThinkPHP Getting Started Tutorial", "ThinkPHP Common Methods Summary", "Smarty Template Basic Tutorial" and "PHP Template Technology Summary".

I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1122888.htmlTechArticleA simple implementation method of thinkPHP3.1 verification code, thinkphp3.1 verification code This article tells the example of thinkPHP3.1 verification code Simple implementation method. Share it with everyone for your reference, the details are as follows: On behalf of...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template