您的位置:首页 > 编程语言 > PHP开发

php5 inpractice看书心得(2)

2011-05-17 22:12 302 查看
第五章

1.array_fill($start,$number,$value)

第六章

1.动态定义函数 create_function()

2.调用自定义函数call_user_func()

3.检查变量是否引用一个函数 is_callable($some)

4.检查方法是否存在method_exists($object,$name)

5.获得当前已定义的函数的列表get_defined_functions()

6. func_num_args() 和func_get_arg(n)

第七章

第八章

fopen($handle)

打开一个资源句柄,并返回,他的是返回结果是资源性的resource

fclose($handle)

关闭文件句柄

fgets($handle[,$maxlen])

获得文件的一行,遇到下一行结束符,文件结束符,或者设定的最大值得限定

fread($handle,$nbytes)

从文件中读取后续的多少个字节,注意后续,他会自己识别指针,然后接着往后面读取,而且两个参数一个也不能少啊

fwrite($handle,$string[,$length])

将$string写入$handle,可以通过$length 来设定长度

file_get_contents($filename)

这里的$filename可以使一个文件,也可以是一个url等等

file($path)

把文件或者URL的全部内容返回到数组,那么他的返回值就是数组,并且他的数组的每一个value都包含行结束符

file_put_contents($filename.$string)

他把fopen fwrite fclose的功能集成在一起了。

改变文件指针的当前位置

fseek

rewind

ftell

处理文件

unlink($filename)

reaname($oldname,$newname)

copy($old,$new)

stat($filename)

创建删除目录

mkdir

rmdir

打开一个流到一个系统命令

$handle=popen($command,$mode)

pclose($handle)

执行系统命令

$output=`comandstring`

$output=shell_exec

####################################

dir()命令的返回结果如下:

object(Directory)#3 (2) {
["path"] => string(1) "."
["handle"] => resource(10) of type (stream)
}

所以可见返回的是一个假冒伪劣对象。

dir() 函数打开一个目录句柄,并返回一个对象。这个对象包含三个方法:read() , rewind() 以及 close()。
若成功,则该函数返回一个目录流,否则返回 false 以及一个 error。可以通过在函数名前加上 "@" 来隐藏 error 的输出。

######################################

stat 返回

数字下标 关联键名 说明
0 dev device number - 设备名
1 ino inode number - inode 号码
2 mode inode protection mode - inode 保护模式
3 nlink number of links - 被连接数目
4 uid userid of owner - 所有者的用户id
5 gid groupid of owner- 所有者的组 id
6 rdev device type, if inode device * - 设备类型,如果是 inode 设备的话
7 size size in bytes - 文件大小的字节数
8 atime time of last access (unix timestamp) - 上次访问时间(Unix 时间戳)
9 mtime time of last modification (unix timestamp) - 上次修改时间(Unix 时间戳)
10 ctime time of last change (unix timestamp) - 上次改变时间(Unix 时间戳)
11 blksize blocksize of filesystem IO * - 文件系统 IO 的块大小
12 blocks number of blocks allocated - 所占据块的数目
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: