php编写生成酷炫验证码
<?php
$im=imagecreate(200,100);//生成画布
imagecolorallocate($im,0,0,0);//背景色
$white=imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));//生成随机颜色
for($i=0;$i<9;$i++)
{
imageline($im,rand(0,200),rand(0,100),rand(0,200),rand(0,100),$white);//生成干扰线条元素
}
for($i=0;$i<150;$i++)
{
imagesetpixel($im,rand(0,200),rand(0,100),$white);//生成干扰点元素
}
for($i=0,$str='';$i<4;$i++)//通过循环获得四个字符
{
switch(rand(1,3))
{
case'1':
$ch=rand(0,9);
break;
case'2':
$ch=sprintf('%c',rand(97,122));
break;
case'3':
$ch=sprintf('%c',rand(65,90));
break;
}
$str.=$ch; }
imagettftext($im,32,rand(0,15),55,70,$white,'c.ttc',$str);//在画布上输出字符串
header("Content-type:image/jpeg");
imagejpeg($im);
imagedestroy($im);
?>
php编写生成酷炫验证码的更多相关文章
- wordpress用Elementor拖拽生成酷炫页面
很多朋友看到wordpress网站做得很高大上,想知道是怎么做到的,其实很简单,用Elementor就能拖拽生成酷炫页面,ytkah就直接上干货了. 1.安装Elementor,到wordpress后 ...
- 编写生成彩色验证码的Servlet
利用Ajax实现无刷新的彩色验证码时,也需要编写一个名称为PictureCheckCode.java的Servlet,该类继承HttpServlet,主要通过service()方法生成验证码. 下面将 ...
- 个人学习JQ插件编写成果:little酷炫的图片滑动切换效果
工作一个多月了,好久没来冒冒泡了,看了@wayong的JQ插件教程,自己编写了一个模仿拉勾网首页广告栏滑动特效的JQ插件,现在跟朋友们分享分享! 先上demo链接:http://runjs.cn/de ...
- IntelliJ IDEA(九) :酷炫插件系列
最近项目比较忙,很久没有更新IDEA系列了,今天介绍一下IDEA的一些炫酷的插件,IDEA强大的插件库,不仅能给我们带来一些开发的便捷,还能提高我们的与众不同. 1.插件的安装 打开setting文件 ...
- IntelliJ IDEA,酷炫插件系列,提高你的工作效率
今天介绍一下IDEA的一些炫酷的插件,IDEA强大的插件库,不仅能给我们带来一些开发的便捷,还能体现我们的与众不同. 1.插件的安装 打开setting文件选择Plugins选项 Ctrl + Alt ...
- Android常用酷炫控件(开源项目)github地址汇总
转载一个很牛逼的控件收集帖... 第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.Gri ...
- IntelliJ IDEA 换背景免费酷炫的插件(转)
一.插件的安装 打开setting文件选择Plugins选项 Ctrl + Alt + S File -> Setting 分别是安装JetBrains插件,第三方插件,本地已下载的插件包. 二 ...
- Flutter酷炫的路由动画效果
现在Flutter的路由效果已经非常不错了,能满足大部分App的需求,但是谁不希望自己的App更酷更炫那,下面介绍几个酷炫的路由动画. 其实路由动画的原理很简单,就是重写并继承PageRouterBu ...
- IntelliJ IDEA,酷炫插件系列,提高你的工作效率【plugins】
今天介绍一下IDEA的一些炫酷的插件,IDEA强大的插件库. 不仅能给我们带来一些开发的便捷,还能体 ...
随机推荐
- C#线程的使用(1)
今天刚开始学习使用线程,把学习过程与新的记录下来. 创建线程: 非常简单,只需声明她并为其提供线程起始点处的方法委托即可: 终止线程: 使用Abort和Join方法来实现: Abort方法:用于永久的 ...
- 通用类 对象Excel互转
public class ExcelHelper { public void Demo(string filePath) { if (File.Exists(filePath)) File.Delet ...
- 急急如律令!火速搭建一个C#即时通信系统!(附源码分享——高度可移植!)
(2016年3月更:由于后来了解到GGTalk开源即时通讯系统,因此直接采用了该资源用于项目开发,在此对作者表示由衷的感谢!) —————————————————————————————————— 人 ...
- 算法与数据结构(二) 栈与队列的线性和链式表示(Swift版)
数据结构中的栈与队列还是经常使用的,栈与队列其实就是线性表的一种应用.因为线性队列分为顺序存储和链式存储,所以栈可以分为链栈和顺序栈,队列也可分为顺序队列和链队列.本篇博客其实就是<数据结构之线 ...
- [Swift]LeetCode59. 螺旋矩阵 II | Spiral Matrix II
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral ord ...
- [Swift]LeetCode132. 分割回文串 II | Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...
- [Swift]LeetCode508. 出现次数最多的子树元素和 | Most Frequent Subtree Sum
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a ...
- [Swift]LeetCode860. 柠檬水找零 | Lemonade Change
At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...
- [Swift]LeetCode987. 二叉树的垂序遍历 | Vertical Order Traversal of a Binary Tree
Given a binary tree, return the vertical order traversal of its nodes values. For each node at posit ...
- [Swift]LeetCode997. 找到小镇的法官 | Find the Town Judge
In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is se ...