<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>运达&#039;s  blog &#187; 验证码</title>
	<atom:link href="https://www.yunda51.com/?feed=rss2&#038;tag=%E9%AA%8C%E8%AF%81%E7%A0%81" rel="self" type="application/rss+xml" />
	<link>https://www.yunda51.com</link>
	<description>运达的博客</description>
	<lastBuildDate>Wed, 12 Nov 2025 07:58:26 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.19</generator>
	<item>
		<title>PHP七种不同的个性创意验证码</title>
		<link>https://www.yunda51.com/?p=1689</link>
		<comments>https://www.yunda51.com/?p=1689#comments</comments>
		<pubDate>Fri, 01 Apr 2016 05:39:47 +0000</pubDate>
		<dc:creator><![CDATA[运达]]></dc:creator>
				<category><![CDATA[php技术]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[验证码]]></category>

		<guid isPermaLink="false">http://www.yunda51.com/?p=1689</guid>
		<description><![CDATA[如图： 验证码图片html代码: &#60;img src=&#34;1.php&#34; onclick=<a href="https://www.yunda51.com/?p=1689" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p><strong>如图：</strong><br />
<a href="http://www.yunda51.com/wp-content/uploads/2016/04/big.jpg.png"><img class="alignnone size-full wp-image-1690" src="http://www.yunda51.com/wp-content/uploads/2016/04/big.jpg.png" alt="big.jpg" width="389" height="724" /></a></p>
<p><strong>验证码图片html代码:</strong></p>
<pre class="wp-code-highlight prettyprint">
&lt;img src=&quot;1.php&quot; onclick=&quot;this.src = &#039;1.php?t=&#039; + Math.random()&quot; title=&quot;点击刷新&quot; /&gt;
</pre>
<p><strong>第一个图像验证码类,其他6种验证码类请下载查看:</strong></p>
<pre class="wp-code-highlight prettyprint">
 class captcha{ 
    /** 
    +---------------------------------------------------------- 
    * 生成验证码 
    +---------------------------------------------------------- 
    * @static 
    * @access public 
    +---------------------------------------------------------- 
    * @param int $len  验证码字符数 
    * @param int $font_size  验证码字体大小 
    * @param string $name  session名称 
    * @param int $width  图片长度 
    * @param int $height  图片高度 
      +---------------------------------------------------------- 
    * @return void 
      +---------------------------------------------------------- 
    */ 
    static function generate($len=4,$font_size=48,$name=&#039;captcha&#039;,$width=&#039;&#039;,$height=&#039;&#039;){ 
        if($width==&#039;&#039;) $width=($font_size+5)*($len+1); 
        if($height==&#039;&#039;) $height=($font_size)*2; 
        $chars=&#039;bcdefhkmnrstuvwxyABCDEFGHKMNPRSTUVWXY345689&#039;; 
        $str=&#039;&#039;; 
        for($i=0;$i&lt;$len;$i++){ 
            $str .= substr($chars,mt_rand(0,strlen($chars)-1),1); 
        } 
        $_SESSION[$name]=$str;//写入session 
        for($num=0;$num&lt;10;$num++){ 
            ob_start(); 
            $image=imagecreatetruecolor($width,$height);//创建图片 
            $bg_color=imagecolorallocate($image,255,255,255);//设置背景颜色 
            $border_color=imagecolorallocate($image,100,100,100);//设置边框颜色 
            $text_color=imagecolorallocate($image,0,0,0);//设置验证码颜色 
            imagefilledrectangle($image,0,0,$width-1,$height-1,$bg_color);//填充图片背景色 
            imagerectangle($image,0,0,$width-1,$height-1,$border_color);//填充图片边框颜色 
            for($i=0;$i&lt;5;$i++){ 
                $line_color=imagecolorallocate($image,rand(0,255),rand(0,255),rand(0,255));//干扰线颜色 
                imageline($image,rand(0,$width),0,$width,$height,$line_color);//画一条线段 
            } 
            for($i=0;$i&lt;500;$i++){ 
                $dot_color=imagecolorallocate($image,rand(0,255),rand(0,255),rand(0,255));//干扰点颜色 
                imagesetpixel($image,rand()%$width,rand()%$height,$dot_color);//画一个像素点 
            } 
            for($i=0;$i&lt;$len;$i++){ 
                imagettftext($image,$font_size,rand(-3,3),$font_size/2+($font_size+5)*$i,$height/1.25-rand(2,3),$text_color,&#039;Groupsex.ttf&#039;,$str[$i]);//用规定字体向图像写入文本 
            } 
            imagegif($image); 
            imagedestroy($image); 
            $imagedata[] = ob_get_contents(); 
            ob_clean(); 
        } 
        require(&#039;GIFEncoder.class.php&#039;); 
        $gif = new GIFEncoder($imagedata); 
        ob_clean();//防止出现&#039;图像因其本身有错无法显示&#039;的问题 
        header(&#039;Content-type:image/gif&#039;); 
        echo $gif-&gt;GetAnimation(); 
    } 
} 
//调用示例 
session_start(); 
captcha::generate(6,48);
</pre>
<p><strong>点击下载：</strong><a style="background: transparent none repeat scroll 0% 0%;" href="http://pan.baidu.com/s/1kVu7U1h" target="_blank"><img class="alignnone size-full wp-image-1075" title="btn_load" src="http://www.yunda51.com/wp-content/uploads/2013/11/btn_load3.png" alt="" width="86" height="28" /></a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.yunda51.com/?feed=rss2&#038;p=1689</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
