导航:首页 > 编程语言 > phppngsupport

phppngsupport

发布时间:2022-07-30 15:31:11

php服务器不能显示验证码

首先从最简单的入手:
如果你只是验证码的图片是小红叉.那么指着小红叉位置.右键"显示图片"即可.如果还不行请刷新页面.

网站的验证码图片一般是“.xbm”格式。Windows XP SP2/Windows 2003操作系统默认情况下不支持“.xbm”格式,造成验证码无法显示。

方法一 手动修改注册表:

开始 /运行 /填入“regedit ” /展开[HKEY_LOCAL_MACHINE-SOFTWARE-Microsoft-Internet Explorer-Security],在右侧窗口找到BlockXBM的Dword值(没有请新建)并双击在弹出的编辑对话框中将其数值数据设为“0”,点击“确定”。
然后在再你需要填入验证码的页面(按F5)刷新一下,应该正常了.

方法二 自动修改注册表:
打开记事本将下边的内容写在记事本上
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Internet Explorer\\Security]
"BlockXBM"=dword:00000000
保存成.reg文件(文件类型选择全部),并双击导入,重启计算机就行了。

如果你是浏览网上银行导致用户名和密码输入框都无法正常显示,那么是你IE设定了阻止ActiveX控件的原因..一般出现这种情况时..先把IE的选项设为默认,然后刷新页面,这时提醒你安装ActiveX控件的时候安装即可

❷ php如何设置,上传图片水印透明度

其实你这个问题很好解决,可能你对gd库函数不是太了解.想要调整水印可以使用imagemerge()这个函数.它最后一个函数就是调节alpha透明度的,

boolimagemerge(resource$dst_im,resource$src_im,int$dst_x,int$dst_y,int$src_x,int$src_y,int$src_w,int$src_h,int$pct)

当 pct = 0 时,实际上什么也没做,当为 100 时对于调色板图像本函数和 image() 完全一样,它对真彩色图像实现了 alpha 透明。

<?php
/**
*();
*bySinaSalek
*
*BugfixbyRalphVoigt(bugwhichcausesit
*toworkonlyfor$src_x=$src_y=0.
*Also,.)
*08-JAN-2011
*
**/
functionimagemerge_alpha($dst_im,$src_im,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h,$pct){
//creatingacutresource
$cut=imagecreatetruecolor($src_w,$src_h);

//
image($cut,$dst_im,0,0,$dst_x,$dst_y,$src_w,$src_h);

//
image($cut,$src_im,0,0,$src_x,$src_y,$src_w,$src_h);

//
imagemerge($dst_im,$cut,$dst_x,$dst_y,0,0,$src_w,$src_h,$pct);
}

?>

❸ php怎么用啊我是初学者(环境搭建好了)

后,默认用户名为root,默认密码为mysql)
下载时下载编译好的那种
解压MySQL,把所有文件复制到/usr/local/mysql
[root@Bleach usr]# groupadd mysql
[root@Bleach usr]# useradd -g mysql mysql
[root@Bleach mysql]# cd mysql
[root@Bleach mysql]# scripts/mysql_install_db --user=mysql
[root@Bleach mysql]# chown -R root .
[root@Bleach mysql]# chown -R mysql data
[root@Bleach mysql]# chgrp -R mysql .
[root@Bleach mysql]# ./bin/mysqld_safe --user=mysql &
[root@Bleach mysql]# ./bin/mysqladmin -u root password mysql
[root@Bleach mysql]# cp ./support-files/mysql.server /etc/init.d/mysql
[root@Bleach mysql]# cd /etc/rc3.d/
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql S85mysql
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql K85mysql
安装GD库基本包gd-devel
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安装XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安装libxml2 (记得PHP5.1.1只支持libxml2-2.6.11以上版本)
#tar zxvf libxml2-2.6.11.tar.gz
#cd libxml2-2.6.11
#./configure
#make
#make install
开始装GD库支持
-------------------------------------------------------
先安装GD基础rpm包
#rpm –ivh gd-devel.rpm
ZLIB
#./configure
#make
#make install
JPEGSRC
#./configure --enable-shared
#make
#make install-lib
#make install
LIBPNG
#cp scripts/makefile.std Makefile
#make
#make install
最后是GD2.*
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很顺利的话,GD就算成功的安装上了. 如果有问题,应该是缺少支持包,总之是少什么就下载什
么来安装上.
跟着下来,开始安装APAHCHE2和PHP5
#./configure --prefix=/usr/local/apache2 --enable-mole=so
#make
#make install
PHP5
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-zlib-dir=/usr/local -with-mysql=/usr/local/mysql --enable-mbstring=all
#make
#make install
复制PHP.INI文件到正确位置
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
AddType application/x-httpd-php .php
查找
index.html
在后面加 index.htm index.php 让它把index.php做为默认页
再找
#ServerName
把#去掉,后面的IP改成你的IP.
找到
"/usr/local/apache2/htdocs"
把两个"/usr/local/apache2/htdocs"改为你存放网页文件的路径
保存httpd.conf文件.
启动它
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下, 我的就是上面所说的 /www
phpinfo();
?>
保存.试试在测试器里打IP进去就可以看到PHPINFO页了
把Apache2加入系统服务
#cd /etc/init.d
#cp /usr/local/apache/bin/apachectl ./httpd
用文本编辑/etc/init.d/httpd
在头部加入
#chkconfig: 345 79 15
#description: Activates/Deactivates Apache Web Server
# processname: httpd
#chkconfig --add httpd
安装ZendOptimizer-2.5.3加速PHP
#./install.sh
------------------------
一直想写篇关于linux下 PHP环境的详细安装配置文章, 没什么时间
趁现要配几台服务器, 借此机会把自己安装配置的步骤写出来, 供初学者参考!
有什么错误的地方请大家指证批评,谢谢! - by Mayer
首先我在 /root 目录下建了一个 soft 文件夹来保存我要安装的源码
mkdir /root/soft
cd /root/soft
先找到 apache php mysql proftpd 源码包下载的URL地址
请浏览

等官方网站
使用wget 直接下载
wget

...
wget

...
wget

...
第一步:安装apache
注:当前目录为/root/soft ,
目录下有
httpd-2.0.55.tar.gz, php-5.0.5.tar.gz
等二进制源码包
#号代表为root 根权限,#后是输入的一条命令
执行下列命令
解压源码包
# tar -zxf httpd-2.0.55.tar.gz
进入安装目录
# cd httpd-2.0.55
配置apache安装信息
# ./configure --prefix=/usr/local/apache --enable-moles=so --enable-rewrite
执行make安装
# make; make install
安装完后
# vi /usr/local/apache/conf/httpd.conf
找到 prefork.c 下的
MaxClients 150
改为
ServerLimit 2000
MaxClients 1000
apache默认工作在prefork.c模式下,并发进程为150,超过后就无法访问,150是远远不够的,所以这里按自己网站的需求改, 如1000
由于apache默认最大并发进程是 256 所以要先设置 ServerLimit 2000 将服务器可设的最大并发数设为2000, 然后再设置最大并发数 MaxClients 1000
找到 #ServerName

在其下设置 ServerName 如下
ServerName

基中

为你网站名,也可用IP代替
找到 DocumentRoot "/usr/local/apache/htdocs"
设置你的 WEB 服务器的根目录 如
DocumentRoot "/myweb"
找到 DirectoryIndex index.html index.html.var 改为
DirectoryIndex index.html index.php index.htm
找到 ForceLanguagePriority Prefer Fallback 在其下加上
AddDefaultCharset gb2312
改完后保存(vi 的用法请查 Linux vi 命令)
用下面命令启动WEB服务器
# /usr/local/apache/bin/apachectl start
查看自己的站点是否正常

也可用IP
用 # /usr/local/apache/bin/apachectl stop 可停止服务
安装MYSQL
# tar -zxf mysql-standard-5.0.15-linux-i686.tar.gz
# cp -r mysql-standard-5.0.15-linux-i686 /usr/local/mysql
# vi /usr/local/mysql/support-files/my-medium.cnf
在后面加上
max_connections = 1000
log-slow-queries
long_query_time = 5
注 max_connections 为允许的最大连接数
log-slow-queries 打开低速查询日志
long_query_time 低速查询的秒数(运行一句sql达到此时间记录在日志里)
然后COPY 它为 /etc/my.cnf 文件
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql mysql
修改mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成mysql系统数据库
# /usr/local/mysql/scripts/mysql_install_db --user=mysql&
启动mysql服务
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data
代表正常启动mysql服务了, 按Ctrl + C 跳出
修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password 123456
回车出现 Enter password: 最开始密码默认为空 继续回车即可
123456 即为你的新密码
安装GD库(让PHP支持GIF,PNG,JPEG)
首先下载 jpeg6,libpng,freetype 并安装模块
wget

...
wget

...
wget

...
wget

...
安装 jpeg6
建立目录
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /root/soft
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install
安装libpng
# cd /root/soft
# tar -zxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install
安装 freetype
# cd /root/soft
# tar -zxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make;make install
安装最新的GD库
# cd /root/soft
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
# make; make install
安装最新的Curl库
# cd /root/soft
# wget

...
# tar -zxf curl-7.15.0.tar.gz
# ./configure --prefix=/usr/local/curl
# make; make install
安装PHP
由于php5需libxml2的支持, 所以先下载并安装libxml2
# cd /root/soft
# wget

...
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
# make; make install
安装 libxslt
# cd /root/soft
# wget
...
# tar -zxf libxslt-1.1.15.tar.gz
# cd libxslt-1.1.15
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
# make; make install
# tar -zxf php-5.0.5.tar.gz
# cd php-5.05
# ./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/
--with-curl=/usr/local/curl --enable-ftp
--with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
--with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/lib --with-png
--with-freetype-dir=/usr/local/freetype
# make
# make install
其中./configure 后的
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
是必要的选项
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项
--with-curl=/usr/local/curl 支持CURL库
--enable-ftp 打开FTP库函数支持
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
配置 httpd.conf 让apache支持PHP
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache/bin/apachectl restart
在你Web目录里建一内容为 PHP文件, 输入URL地址查看PHP配置是否正确
安装 phpmyadmin
下载
# cd /root/soft
# wget

...
# tar -zxf phpMyAdmin-2.6.4-pl3.tar.gz
# vi phpMyAdmin-2.6.4-pl3/config.inc.php
找到 $cfg['Servers'][$i]['auth_type'] = 'config'; 将config 改为 http
保存后
mv phpMyAdmin-2.6.4-pl3 /你的phpmyadmin目录
关于mysql4.1-4移植4.0旧数据库中文乱码问题的解决方法
进入phpmyadmin管理
建立你数据库名并选上 gb2312_bin 的编码
然后导入你先前备份好的SQL文件, 导入时选择 文件的字符集:gb2312
完成后就OK了
注: PHP连接mysql4.1和5.0 数据库后需指定字符集 需执行如 mysql_query("SET NAMES 'gb2312' ");
否则会产生中文乱码问题!

❹ php如何生成加粗或者斜体的文字样式图片

  1. 加粗或者斜体的文字可以用php的函数控制.我想你是想生成验证码图片是吗?

  2. 如果是想生成验证么图片有几个函数可以考虑

    imagecreate($length,$height)创建图片.参数是图片的宽度和高度

    imagecolorallocate($image,$r,$g,$b)设置背景色,r b g就是图片的三色rgb参数.这个可以由传入0-255的随机数决定随机的背景色.还可以生成字体色

    imagettftext($_image,$fontSize,mt_rand(-40,70),$codeNX,$fontSize*1.5,$_color,$ttf,$code[$i]);写入随机的文字,这里要一个字一个字写.所以这个函数要循环调用.

    网络了一下 找到了一个类...如下


  3. <?php
    /**
    *安全验证码
    *
    *安全的验证码要:验证码文字扭曲、旋转,使用不同字体,添加干扰码。
    *如果用中文做验证码(我这里不是哦,有兴趣你来改成用中文的),安全度会更好些,但验证码扭曲和旋转是王道,用了字体也算是已经给字体扭曲了,我就不再去给他添一只扭曲的足了。
    *可配置的属性都是一些简单直观的变量,我就不用弄一堆的setter/getter了
    *
    *@author流水孟春<cmpan(at)qq.com>
    *@rightNEWBSD
    *@linkhttp://labs.yulans.cn/YL_Security_Secoder
    *@linkhttp://wiki.yulans.cn/docs/yl/security/secoder
    */
    classYL_Security_Secoder{
    /**
    *验证码的session的下标
    *
    *@varstring
    */
    publicstatic$seKey='sid.sekey.ylans.cn';
    publicstatic$expire=3000;//验证码过期时间(s)
    /**
    *验证码中使用的字符,01IO容易混淆,建议不用
    *
    *@varstring
    */
    publicstatic$codeSet='346789ABCDEFGHJKLMNPQRTUVWXY';
    publicstatic$fontSize=25;//验证码字体大小(px)
    publicstatic$useCurve=true;//是否画混淆曲线
    publicstatic$useNoise=true;//是否添加杂点
    publicstatic$imageH=0;//验证码图片宽
    publicstatic$imageL=0;//验证码图片长
    publicstatic$length=4;//验证码位数
    publicstatic$bg=array(243,251,254);//背景

    protectedstatic$_image=null;//验证码图片实例
    protectedstatic$_color=null;//验证码字体颜色

    /**
    *输出验证码并把验证码的值保存的session中
    *验证码保存到session的格式为:$_SESSION[self::$seKey]=array('code'=>'验证码值','time'=>'验证码创建时间');
    */
    publicstaticfunctionentry(){
    //图片宽(px)
    self::$imageL||self::$imageL=self::$length*self::$fontSize*1.5+self::$fontSize*1.5;
    //图片高(px)
    self::$imageH||self::$imageH=self::$fontSize*2;
    //建立一幅self::$imageLxself::$imageH的图像
    self::$_image=imagecreate(self::$imageL,self::$imageH);
    //设置背景
    imagecolorallocate(self::$_image,self::$bg[0],self::$bg[1],self::$bg[2]);
    //验证码字体随机颜色
    self::$_color=imagecolorallocate(self::$_image,mt_rand(1,120),mt_rand(1,120),mt_rand(1,120));
    //验证码使用随机字体
    $ttf=dirname(__FILE__).'/ttfs/'.mt_rand(1,20).'.ttf';

    if(self::$useNoise){
    //绘杂点
    self::_writeNoise();
    }
    if(self::$useCurve){
    //绘干扰线
    self::_writeCurve();
    }

    //绘验证码
    $code=array();//验证码
    $codeNX=0;//验证码第N个字符的左边距
    for($i=0;$i<self::$length;$i++){
    $code[$i]=self::$codeSet[mt_rand(0,27)];
    $codeNX+=mt_rand(self::$fontSize*1.2,self::$fontSize*1.6);
    //写一个验证码字符
    imagettftext(self::$_image,self::$fontSize,mt_rand(-40,70),$codeNX,self::$fontSize*1.5,self::$_color,$ttf,$code[$i]);
    }

    //保存验证码
    isset($_SESSION)||session_start();
    $_SESSION[self::$seKey]['code']=join('',$code);//把校验码保存到session
    $_SESSION[self::$seKey]['time']=time();//验证码创建时间

    header('Cache-Control:private,max-age=0,no-store,no-cache,must-revalidate');
    header('Cache-Control:post-check=0,pre-check=0',false);
    header('Pragma:no-cache');
    header("content-type:image/png");

    //输出图像
    imagepng(self::$_image);
    imagedestroy(self::$_image);
    }

    /**
    *画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数)
    *
    *高中的数学公式咋都忘了涅,写出来
    * 正弦型函数解析式:y=Asin(ωx+φ)+b
    *各常数值对函数图像的影响:
    *A:决定峰值(即纵向拉伸压缩的倍数)
    *b:表示波形在Y轴的位置关系或纵向移动距离(上加下减)
    *φ:决定波形与X轴位置关系或横向移动距离(左加右减)
    *ω:决定周期(最小正周期T=2π/∣ω∣)
    *
    */
    protectedstaticfunction_writeCurve(){
    $A=mt_rand(1,self::$imageH/2);//振幅
    $b=mt_rand(-self::$imageH/4,self::$imageH/4);//Y轴方向偏移量
    $f=mt_rand(-self::$imageH/4,self::$imageH/4);//X轴方向偏移量
    $T=mt_rand(self::$imageH*1.5,self::$imageL*2);//周期
    $w=(2*M_PI)/$T;

    $px1=0;//曲线横坐标起始位置
    $px2=mt_rand(self::$imageL/2,self::$imageL*0.667);//曲线横坐标结束位置
    for($px=$px1;$px<=$px2;$px=$px+0.9){
    if($w!=0){
    $py=$A*sin($w*$px+$f)+$b+self::$imageH/2;//y=Asin(ωx+φ)+b
    $i=(int)((self::$fontSize-6)/4);
    while($i>0){
    imagesetpixel(self::$_image,$px+$i,$py+$i,self::$_color);//这里画像素点比imagettftext和imagestring性能要好很多
    $i--;
    }
    }
    }

    $A=mt_rand(1,self::$imageH/2);//振幅
    $f=mt_rand(-self::$imageH/4,self::$imageH/4);//X轴方向偏移量
    $T=mt_rand(self::$imageH*1.5,self::$imageL*2);//周期
    $w=(2*M_PI)/$T;
    $b=$py-$A*sin($w*$px+$f)-self::$imageH/2;
    $px1=$px2;
    $px2=self::$imageL;
    for($px=$px1;$px<=$px2;$px=$px+0.9){
    if($w!=0){
    $py=$A*sin($w*$px+$f)+$b+self::$imageH/2;//y=Asin(ωx+φ)+b
    $i=(int)((self::$fontSize-8)/4);
    while($i>0){
    imagesetpixel(self::$_image,$px+$i,$py+$i,self::$_color);//这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出(不用这while循环)性能要好很多
    $i--;
    }
    }
    }
    }

    /**
    *画杂点
    *往图片上写不同颜色的字母或数字
    */
    protectedstaticfunction_writeNoise(){
    for($i=0;$i<10;$i++){
    //杂点颜色
    $noiseColor=imagecolorallocate(
    self::$_image,
    mt_rand(150,225),
    mt_rand(150,225),
    mt_rand(150,225)
    );
    for($j=0;$j<5;$j++){
    //绘杂点
    imagestring(
    self::$_image,
    5,
    mt_rand(-10,self::$imageL),
    mt_rand(-10,self::$imageH),
    self::$codeSet[mt_rand(0,27)],//杂点文本为随机的字母或数字
    $noiseColor
    );
    }
    }
    }

    /**
    *验证验证码是否正确
    *
    *@paramstring$code用户验证码
    *@returnbool用户验证码是否正确
    */
    publicstaticfunctioncheck($code){
    isset($_SESSION)||session_start();
    //验证码不能为空
    if(empty($code)||empty($_SESSION[self::$seKey])){
    returnfalse;
    }
    //session过期
    if(time()-$_SESSION[self::$seKey]['time']>self::$expire){
    unset($_SESSION[self::$seKey]);
    returnfalse;
    }

    if($code==$_SESSION[self::$seKey]['code']){
    returntrue;
    }

    returnfalse;
    }
    }


    //useage
    /*
    YL_Security_Secoder::$useNoise=false;//要更安全的话改成true
    YL_Security_Secoder::$useCurve=true;
    YL_Security_Secoder::entry();
    */

    /*
    //验证验证码
    if(!YL_Security_Secoder::check(@$_POST['secode'])){
    print'errorsecode';
    }
    */
  4. 这是效果

❺ PHP header 生成验证图片问题

function yzImg($nmsg){
if (function_exists('imagecreatetruecolor')){
$imstr[0]["s"]=$nmsg[0];
$imstr[1]["s"]=$nmsg[1];
$imstr[2]["s"]=$nmsg[2];
$imstr[3]["s"]=$nmsg[3];
//文件头...
header("Content-type: image/png");
//创建真彩色白纸
$im = @imagecreatetruecolor(60, 20) or die("建立图像失败");
//获取背景颜色
$background_color = imagecolorallocate($im, 255, 255, 255);
//填充背景颜色(这个东西类似油桶)
imagefill($im,0,0,$background_color);
//获取边框颜色
$border_color = imagecolorallocate($im,200,200,200);
//画矩形,边框颜色200,200,200
imagerectangle($im,0,0,59,19,$border_color);
//逐行炫耀背景,全屏用1或0
for($i=2;$i<18;$i++){
//获取随机淡色
$line_color = imagecolorallocate($im,rand(180,255),rand(180,255),rand(180,255));
//画线
imageline($im,2,$i,57,$i,$line_color);
}
//设置字体大小
$font_size=14;
//设置印上去的文字
$Str[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$Str[1] = "abcdefghijklmnopqrstuvwxyz";
$Str[2] = "01234567891234567890123456";
//获取第1个随机文字
//$imstr[0]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[0]["x"] = rand(2,5);
$imstr[0]["y"] = rand(1,4);
//获取第2个随机文字
//$imstr[1]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[1]["x"] = $imstr[0]["x"]+$font_size-1+rand(0,1);
$imstr[1]["y"] = rand(1,3);
//获取第3个随机文字
//$imstr[2]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[2]["x"] = $imstr[1]["x"]+$font_size-1+rand(0,1);
$imstr[2]["y"] = rand(1,4);
//获取第4个随机文字
//$imstr[3]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[3]["x"] = $imstr[2]["x"]+$font_size-1+rand(0,1);
$imstr[3]["y"] = rand(1,3);
//写入随机字串
for($i=0;$i<4;$i++){
//获取随机较深颜色
$text_color = imagecolorallocate($im,rand(80,180),rand(80,180),rand(80,180));
//画文字
imagechar($im,$font_size,$imstr[$i]["x"],$imstr[$i]["y"],$imstr[$i]["s"],$text_color);
}
//显示图片
imagepng($im);
//销毁图片
imagedestroy($im);
exit;
} else {
header("Pragma:no-cache");
header("Cache-control:no-cache");
header("ContentType: Image/BMP");

$Color[0] = chr(0).chr(0).chr(0);
$Color[1] = chr(255).chr(255).chr(255);
$_Num[0] = "";
$_Num[1] = "";
$_Num[2] = "";
$_Num[3] = "";
$_Num[4] = "";
$_Num[5] = "";
$_Num[6] = "";
$_Num[7] = "";
$_Num[8] = "";
$_Num[9] = "";

echo chr(66).chr(77).chr(230).chr(4).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(54).chr(0).chr(0).chr(0).chr(40).chr(0).chr(0).chr(0).chr(40).chr(0).chr(0).chr(0).chr(10).chr(0).chr(0).chr(0).chr(1).chr(0);
echo chr(24).chr(0).chr(0).chr(0).chr(0).chr(0).chr(176).chr(4).chr(0).chr(0).chr(18).chr(11).chr(0).chr(0).chr(18).chr(11).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0);

for ($i=9;$i>=0;$i--){
for ($j=0;$j<=3;$j++){
for ($k=1;$k<=10;$k++){
echo $Color[substr($_Num[$nmsg[$j]], $i * 10 + $k, 1)];
}
}
}
exit;
}
}
你可以看一下这个是php168的验证码主要程序

❻ 如何开启Php-mbstring、Php-gd模块

找到你的PHP环境中的php.ini文件,搜索下面两行,查看是否前面有分号(;),如果有,去掉,然后重新启动Web服务器(如:Apache,IIS等):
extension=php_gd2.dll
extension=php_mbstring.dll
如果你的服务可以正常启动,应该就已经加载了这两个模块,如果不能启动,你还需要查看一项:
extension_dir =
看看你这项设置的路径是什么,相应的路径里有没有上面加载的两个dll文件,如果没有,你需要根据你的PHP版本去下载相应的文件,并且放到extension_dir指定的目录中。
当然,Linux环境下的实现方式是一致的,只是加载的文件的后缀可能不是.dll,具体是什么我忘记了。

❼ 10分windows下怎么安装 PHP的gd库

先确保php.ini路径正确。
在apache配置文件httpd.conf里使用PHPIniDir指写php.ini的在目录
如:PHPIniDir "f:/php"

在f:\php\php.ini里加入

extension_dir = "f:\php\ext"
extension=php_gd2.dll

(f:\php 改成你自己的php目录)

重启apache

<?php
phpinfo();
?>
看一下GD是否已经加载上,
如果已经加载上,在页面中间会显示类似以下信息

gd
GD Support enabled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.7
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled

阅读全文

与phppngsupport相关的资料

热点内容
战地联盟3解压密码 浏览:803
s型命令 浏览:23
php年薪5年 浏览:67
如何上网上设个人加密账户 浏览:44
linux打开ssh服务 浏览:78
微信位置可以加密吗 浏览:470
算法蛮力法 浏览:438
随机排练命令 浏览:147
python多进程并发 浏览:41
安卓软件安装如何躲避安全检测 浏览:647
奇幻潮翡翠台源码百度云盘 浏览:187
什么软件可以免费pdf转word 浏览:15
php正则表达式大全 浏览:394
androidntp时间 浏览:299
轮机长命令簿英文 浏览:148
oppo铃声设置被加密怎么处理 浏览:548
粤苗app图形验证码怎么填 浏览:899
管家婆架设云服务器 浏览:254
php的登录界面代码 浏览:997
php开发客户端 浏览:998