How to set the width and height of thinkphp verification code
#Think\Verify class can support the generation and verification functions of verification codes.
In order to display this verification code function, first there must be a controller, then there must be a method, and then there must be a displayed page.
Related recommendations: "ThinkPHP Tutorial"
The simplest way to generate a verification code:
(1) We still continue to write in that controller Method
This method displays the page of this verification code
public function xianshi() { $this->show(); }
public function shengcheng() { //造验证码的对象 $v = new \Think\Verify(); //生成验证码 $v->entry(); }
(2) The page that displays the verification code should still be placed in , name it
<img src="/static/imghwm/default1.png" data-src="__CONTROLLER__/shengcheng" class="lazy" / alt="How to set the width and height of thinkphp verification code" >
Run it and see the results:
(3) We can also set the size for it, and every time the page is refreshed, The verification code will change.
Just give him an attribute, for example:
<img src="/static/imghwm/default1.png" data-src="__CONTROLLER__/shengcheng" class="lazy" style="max-width:90%" style="max-width:90%" / alt="How to set the width and height of thinkphp verification code" >
Both width and height become larger
About verification Code parameters
These parameters can be used to transform the verification code.
Note: There are two ways to set parameters.
1. Instantiation incoming parameters:
$config = array( 'fontSize' => 30, // 验证码字体大小 'length' => 3, // 验证码位数 'useNoise' => false, // 关闭验证码杂点 ); $Verify = new \Think\Verify($config); $Verify->entry();
2. Dynamic settings:
$Verify = new \Think\Verify(); $Verify->fontSize = 30; $Verify->length = 3; $Verify->useNoise = false; $Verify->entry();
The above is the detailed content of How to set the width and height of thinkphp verification code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool