php解压文件,压缩
zip.class.php
CODE:
[复制到剪切板]
<?
class
zip
{
var
$datasec
,
$ctrl_dir
= array();
var
$eof_ctrl_dir
=
"x50x4bx05x06x00x00x00x00"
;
var
$old_offset
=
0
; var
$dirs
= Array(
"."
);
function
get_List
(
$zip_name
)
{
$zip
= @
fopen
(
$zip_name
,
'rb'
);
if(!
$zip
) return(
0
);
$centd
=
$this
->
ReadCentralDir
(
$zip
,
$zip_name
);
@
rewind
(
$zip
);
@
fseek
(
$zip
,
$centd
[
'offset'
]);
for (
$i
=
0
;
$i
<
$centd
[
'entries'
];
$i
++)
{
$header
=
$this
->
ReadCentralFileHeaders
(
$zip
);
$header
[
'index'
] =
$i
;
$info
[
'filename'
] =
$header
[
'filename'
];
$info
[
'stored_filename'
] =
$header
[
'stored_filename'
];
$info
[
'size'
] =
$header
[
'size'
];
$info
[
'compressed_size'
]=
$header
[
'compressed_size'
];
$info
[
'crc'
] =
strtoupper
(
dechex
(
$header
[
'crc'
] ));
$info
[
'mtime'
] =
$header
[
'mtime'
];
$info
[
'comment'
] =
$header
[
'comment'
];
$info
[
'folder'
] = (
$header
[
'external'
]==
0x41FF0010
||
$header
[
'external'
]==
16
)?
1
:
0
;
$info
[
'index'
] =
$header
[
'index'
];
$info
[
'status'
] =
$header
[
'status'
];
$ret
[]=
$info
; unset(
$header
);
}
return
$ret
;
}
funct
相关文档:
0、用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。
1、如果能将类的方法定义成static,就尽量 ......
转自:伊图网[www.4ico.com]在阐述类的概念之前我们来先说说面向对象编程的概念:面向对象的程序设计(Object-Oriented Programming,简记为OOP)立意于创建软件重用代码,具备更好地模拟现实世界环境的能力,这使它被公认为是自上而下编程的优胜者。它通过给程序中加入扩展语句,把函数“封装”进编程所必需的&l ......
本文转自 http://www.phpchina.com/html/31/35331-12207.html
PHP里边用Static关键字来定义静态属性和方法.
实例一:静态属性的引用方法
<?php
/*
*author:ajax123
*qq:283400245
*/
class person{
static$name="ajax123";//static声明静态属性
  ......
php编译gd出错!(已解决)
在32位ubuntu9.04上编译php5.2.12,到gd时make出错:
ext/gd/libgd/.libs/gd_png.o: In function
`php_gd_gdImageCreatefromPngCtx':
/home/test/php-5.2.12/ext/gd/libgd/gd_png.c:142: undefined reference to
`png_check_sig'
collect2: ld returned 1 exit status
make: *** [sapi/cli/p ......
原文链接:http://www.phpdo.net/index.php/2010/02/04/1-11/
PHP数组(array)
把值映射到键的类型。
PHP对象(object)
对现实生活中物体的模拟。
PHP空值(null)
表示一个没有值的量。
例如:
<?php
$php = “”;
if(isset($a))
echo “[1] is NULL<br>”; ......