tp生成验证码

视图层:

        <input type="text" name="code" value="" />
        <img onclick="this.src='__URL__/code/'+Math.random()" style="cursor:pointer" src="__URL__/code" style="20px;height:30px;"/>
 控制器层:

     //生成验证码
    public function code()
    {
        //$Verify = new ThinkVerify();
        //$Verify->entry();
        $Verify =     new ThinkVerify();
        $Verify->fontSize = 30;
        $Verify->length   = 4;
        //$Verify->useNoise = false;
        $Verify->entry();
    }

原文地址:https://www.cnblogs.com/shaohuixia/p/5511864.html