How to implement simple Chinese verification code function in php

墨辰丷
Release: 2023-03-28 09:08:01
Original
1213 people have browsed it

This article mainly introduces the simple Chinese verification code function implemented by PHP. It analyzes the implementation steps and operation methods of PHP Chinese verification code function in the form of examples, including graphic creation, coding operations, session operations and other related skills. Required Friends can refer to

as follows:

img.php


0-max 不大于100 for($i=0;$i<200;$i++) { imagesetpixel($image, rand()%100, rand()%30, $color2); } //$str = iconv("gbk", "utf-8", "中"); $str = "中国"; $_SESSION[check_pic] = $str; //解决中文,页面本身为utf-8 $str = mb_convert_encoding($str, "html-entities","utf-8" ); //2:字体大小 3:倾斜角度 x , y 坐标 imagettftext($image, 12, 0, 20, 20, $color, 'MSYH.TTF', $str); //输出图片 header("Content-type: image/jpeg;charset=utf-8"); imagejpeg($image); /*修改eclipse的配置,可以使得eclipse的新建项目的默认编码直接为UTF-8 在菜单栏的 Window->Preferences->General->Workspace->Text file encoding 将其改为UFT-8即可。*/ ?>
Copy after login


##sub.php


 


Copy after login


The running effect is as follows:


The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

Copy ecshop in PHPVerification codeExample

PHPVerification codeClass ValidateCode analysis

##PHP generated image

Verification codeDetailed function explanation

The above is the detailed content of How to implement simple Chinese verification code function in php. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!