php5 inpractice看书心得(2)

第五章node

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

  

第六章数组

1.动态定义函数 create_function()ide

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

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

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

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

6. func_num_args() 和func_get_arg(n)unix

 

第七章指针

 

 

 

 

 

第八章

 

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()命令的返回结果以下:

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

 因此可见返回的是一个假冒伪劣对象。

 

dir() 函数打开一个目录句柄,并返回一个对象。这个对象包含三个方法:read() , rewind() 以及 close()。

若成功,则该函数返回一个目录流,不然返回 false 以及一个 error。能够经过在函数名前加上 "@" 来隐藏 error 的输出。

 

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

 stat 返回

  
  
  
  
    1. 数字下标 关联键名 说明  
    2. 0 dev device number - 设备名  
    3. 1 ino inode number - inode 号码  
    4. 2 mode inode protection mode - inode 保护模式  
    5. 3 nlink number of links - 被链接数目  
    6. 4 uid userid of owner - 全部者的用户id  
    7. 5 gid groupid of owner- 全部者的组 id  
    8. 6 rdev device type, if inode device * - 设备类型,若是是 inode 设备的话  
    9. 7 size size in bytes - 文件大小的字节数  
    10. 8 atime time of last access (unix timestamp) - 上次访问时间(Unix 时间戳)  
    11. 9 mtime time of last modification (unix timestamp) - 上次修改时间(Unix 时间戳)  
    12. 10 ctime time of last change (unix timestamp) - 上次改变时间(Unix 时间戳)  
    13. 11 blksize blocksize of filesystem IO * - 文件系统 IO 的块大小  
    14. 12 blocks number of blocks allocated - 所占据块的数目  
相关文章
相关标签/搜索