


PHP method to generate clickable refresh verification code and simple example
This article mainly introduces the verification code generated by PHP that can be clicked to refresh. It analyzes the implementation and call display method of PHP verification code in the form of simple examples. It involves the related skills of dynamically calling the verification code PHP file with js. Friends who need it can For reference,
is as follows:
html file:
<html> <head> <title>验证码</title> </head> <script type="text/javascript"> function yanzheng(){ var im=document.getElementsByTagName("img"); im[0].src="gd.php?temp="+(new Date().getTime().toString(36)); } </script> <body> <img src="gd.php"/><a href="#" onclick="yanzheng()">换一张</a> </body> </html>
Verification code file gd.php:
<?php $im=imagecreate(50,20); $b=imagecolorallocate($im,0,0,0); $w=imagecolorallocate($im,255,255,255); $mask="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $text=""; for($i=1;$i<=4;$i++){ $index=rand(0,61); $text.=$mask{$index}; } imagestring($im,3,rand(10,20),rand(0,10),$text,$w); header("Content-type:image/jpeg"); imagejpeg($im); ?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
PHP method to implement sorting of a certain key in a two-dimensional array
PHP automatically identifies the mobile terminal currently in use
PHP custom function format json data instance
The above is the detailed content of PHP method to generate clickable refresh verification code and simple example. 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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
