php常用函数

来源:互联网 发布:lua 5.2 for windows 编辑:程序博客网 时间:2024/05/17 00:52
sleep(1)    //延迟执行时间  
md5()       //md5加密
header('Content-Type:text/html; charset=utf-8');   //设置页面编码
date_default_timezone_set('PRC');                  //设置时区
header("Content-type: text/html; charset=utf-8");  //输出utf-8的头信息
strrchr()                                          //查找指定字符在字符串中的最后一次出现
@                                                  //错误抑制符   把非致命性的错误 屏蔽掉
mt_rand                                            //返回随机整数。 mt_rand(min,max)
getimagesize("./images./1.jpg");                   //获取原图的宽度和高度
 
//打开各种类型的图片  (gif jpeg png)
  imagecreatefromgif("1.gif");
  imagecreatefromjpeg("1.jpeg");
  imagecreatefrompng("1.png");
 
//新建图片 width 500px height:300px
  imagecreatetruecolor(500,300);                     
 
 
//3,复制大图粘贴到小图,并且调整图片大小
//imagecopyresized
//参数1:目标(小图)的资源;
//参数2:原图资源 ;
//参数3,4:要放到目标图的X,Y;
//参数5,6:从原图复制的X,Y;
//参数7,8:复制到目标图后的宽度,高度;
//参数9,10:要在原图复制的区域的宽,高度
 
imagecopyresized($smail_img,$f_img,0,0,0,0,$smail_w,$smail_h,$img_w,$img_h);
 
 
//输出图像
bool imagegif ( resource$image [, string$filename ] )
imagejpeg();
imagepng();
 
 
//释放资源
imagedestroy($old_img);//释放老图片
imagedestroy($new_img);//释放新的图片
0 0
原创粉丝点击