php 948

#PHP
php高并发访问写文件

function write ( $data ) { $return = false; if ( $handle = @fopen ( 'error.txt','a+' ) ) {…

2015-01-09 754

#PHP
php通过加http响应头强制用户下载

php中可以通过设置header的content-type,强制用户下载内容,而非直接在浏览器中打开,如下代码实现: downloadFile.php <?php $file…

2015-01-09 189

#PHP
PHP 对 png 图像进行缩放,支持透明背景

function smart_resize_image( $file, $width = 0, $height = 0, $proportional = false, $outpu…

2015-01-08 869

#PHP
php过滤html标签

/** * 过滤字符串中的html标签 * * @param string $string 待转换的字符串 * @return string */ static public fu…

2015-01-08 360

#PHP
PHP去除多余空格 多个连续空格只保留一个

/** * 多个连续空格只保留一个 * * @param string $string 待转换的字符串 * @return unknown */ static public fun…

2015-01-08 542

#PHP
PHP抓取网页代码示例

//PHP(前提是装了curl): $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, "http://www.xxx/&…

2015-01-08 547

#PHP
PHP图片上传类;支持水印-日期文件夹-生成缩略图 ,支持多文件上传

可以用{Y}{m}{n}来变成现在的日期 set_dir(dirname(__FILE__).'/upload/','{y}/{m}'); //保存路径,支持{y}{m}{d}这几…

2015-01-08 878

#PHP
php给图片加水印的代码

在使用php编程的时候, 很多时候需要对上传的图片加水印,来确定图片版权和出处. 但是,一般情况下加水印的位置是图片的右下角,但是,不同图片的色阶不同,有时候我们图片的水印和图片本…

2015-01-08 922

#PHP
php验证码类

<? /** * 验证码类 * @author firerat * @email lukai_rat@163.com * @time Feb 16 2011 15:28 * …

2015-01-08 369

#PHP
获取某个月的最后一天或某个月的天数

//获取某个月的最后一天或某个月的天数 function getMonthLastDay ( $month, $year ) { switch ( $month ) { case …

2015-01-08 836

#PHP
查找出现次数最多的字符PHP代码

$arr=str_split($str); $arr=array_count_values($arr); arsort($arr); print_r($arr);

2015-01-08 910

#PHP
获得客户端使用操作系统类型的php代码

function userOS(){ $user_OSagent = $_SERVER['HTTP_USER_AGENT']; if(strpos($user_OSagent,&q…

2015-01-08 291
1 73 74 75 76 77 79