php 948

#PHP
php高并发访问写文件

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

2015-01-09 731

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

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

2015-01-09 168

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

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

2015-01-08 520

#PHP
PHP抓取网页代码示例

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

2015-01-08 526

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

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

2015-01-08 858

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

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

2015-01-08 897

#PHP
php验证码类

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

2015-01-08 348

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

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

2015-01-08 816

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

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

2015-01-08 888

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

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

2015-01-08 269

#PHP
截取中文字符串PHP代码

/** * * 中文字符串截取 * @param string $string * @param int $sublen * @param int $start * @param …

2015-01-08 353

#PHP
php匹配url的正则表达式

//https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)? //PHP Example: Automatically link UR…

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